diff options
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs | 8 |
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()); + } } } |