aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@users.noreply.github.com>2016-01-26 08:43:45 -0800
committerJan Tattermusch <jtattermusch@users.noreply.github.com>2016-01-26 08:43:45 -0800
commitb13874d59e976371a1a87e6dc2bf347ed0a0ce5d (patch)
treed42e74c8539d2f52afdc92bc25145c50f67937ff /csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
parent60f7fc51fb01ac98fd64d9372e7547f5ab267ce5 (diff)
parentdd43dcca8c3a0af761ae981edcadd7e78e875fe8 (diff)
downloadprotobuf-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/DurationTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
index 1aa02e16..141faf80 100644
--- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs
@@ -120,5 +120,13 @@ namespace Google.Protobuf.WellKnownTypes
var duration = new Duration { Seconds = seconds, Nanos = nanoseconds };
duration.ToTimeSpan();
}
+
+ [Test]
+ public void ToString_NonNormalized()
+ {
+ // Just a single example should be sufficient...
+ var duration = new Duration { Seconds = 1, Nanos = -1 };
+ Assert.AreEqual("{ \"@warning\": \"Invalid Duration\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString());
+ }
}
}