diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-01-26 08:43:45 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-01-26 08:43:45 -0800 |
commit | b13874d59e976371a1a87e6dc2bf347ed0a0ce5d (patch) | |
tree | d42e74c8539d2f52afdc92bc25145c50f67937ff /csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs | |
parent | 60f7fc51fb01ac98fd64d9372e7547f5ab267ce5 (diff) | |
parent | dd43dcca8c3a0af761ae981edcadd7e78e875fe8 (diff) | |
download | protobuf-b13874d59e976371a1a87e6dc2bf347ed0a0ce5d.tar.gz protobuf-b13874d59e976371a1a87e6dc2bf347ed0a0ce5d.tar.bz2 protobuf-b13874d59e976371a1a87e6dc2bf347ed0a0ce5d.zip |
Merge pull request #1158 from jskeet/nonnormalized-tostring
Ensure that FieldMask, Timestamp and Duration ToString() calls don't throw
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs index 84717d66..9ecd24c6 100644 --- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs +++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs @@ -103,5 +103,13 @@ namespace Google.Protobuf.WellKnownTypes Assert.AreEqual(t1, t2 + difference); Assert.AreEqual(t2, t1 - difference); } + + [Test] + public void ToString_NonNormalized() + { + // Just a single example should be sufficient... + var duration = new Timestamp { Seconds = 1, Nanos = -1 }; + Assert.AreEqual("{ \"@warning\": \"Invalid Timestamp\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString()); + } } } |