aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-05-12 09:47:19 +0100
committerJon Skeet <jonskeet@google.com>2015-05-12 09:48:02 +0100
commit90c8932fc7316b5afaae350395624b6fd2e73a97 (patch)
tree080924d0a9fd8f52d88b1ee4fb76f9aa3bd802cd /csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs
parentc58b2c66448f83c25da0251fe6cf5b12299fa581 (diff)
downloadprotobuf-90c8932fc7316b5afaae350395624b6fd2e73a97.tar.gz
protobuf-90c8932fc7316b5afaae350395624b6fd2e73a97.tar.bz2
protobuf-90c8932fc7316b5afaae350395624b6fd2e73a97.zip
Convert back to using NUnit, which is now loaded via NuGet.
This includes the NUnit test adapter which allows NUnit tests to be run under VS without any extra plugins. Unfortunate the compatibility tests using the abstract test fixture class show up as "external" tests, and aren't well presented - but they do run.
Diffstat (limited to 'csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs')
-rw-r--r--csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs50
1 files changed, 25 insertions, 25 deletions
diff --git a/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs b/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs
index e4f9acff..9c864618 100644
--- a/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs
+++ b/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs
@@ -35,66 +35,66 @@
#endregion
using Google.ProtocolBuffers.TestProtos;
-using Xunit;
+using NUnit.Framework;
namespace Google.ProtocolBuffers
{
public class TestLiteByApi
{
- [Fact]
+ [Test]
public void TestAllTypesEquality()
{
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
TestAllTypesLite copy = msg.ToBuilder().Build();
- Assert.Equal(msg.GetHashCode(), copy.GetHashCode());
- Assert.True(msg.Equals(copy));
+ Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsTrue(msg.Equals(copy));
msg = msg.ToBuilder().SetOptionalString("Hi").Build();
- Assert.NotEqual(msg.GetHashCode(), copy.GetHashCode());
- Assert.False(msg.Equals(copy));
+ Assert.AreNotEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsFalse(msg.Equals(copy));
copy = copy.ToBuilder().SetOptionalString("Hi").Build();
- Assert.Equal(msg.GetHashCode(), copy.GetHashCode());
- Assert.True(msg.Equals(copy));
+ Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsTrue(msg.Equals(copy));
}
- [Fact]
+ [Test]
public void TestEqualityOnExtensions()
{
TestAllExtensionsLite msg = TestAllExtensionsLite.DefaultInstance;
TestAllExtensionsLite copy = msg.ToBuilder().Build();
- Assert.Equal(msg.GetHashCode(), copy.GetHashCode());
- Assert.True(msg.Equals(copy));
+ Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsTrue(msg.Equals(copy));
msg = msg.ToBuilder().SetExtension(UnittestLite.OptionalStringExtensionLite, "Hi").Build();
- Assert.NotEqual(msg.GetHashCode(), copy.GetHashCode());
- Assert.False(msg.Equals(copy));
+ Assert.AreNotEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsFalse(msg.Equals(copy));
copy = copy.ToBuilder().SetExtension(UnittestLite.OptionalStringExtensionLite, "Hi").Build();
- Assert.Equal(msg.GetHashCode(), copy.GetHashCode());
- Assert.True(msg.Equals(copy));
+ Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode());
+ Assert.IsTrue(msg.Equals(copy));
}
- [Fact]
+ [Test]
public void TestAllTypesToString()
{
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
TestAllTypesLite copy = msg.ToBuilder().Build();
- Assert.Equal(msg.ToString(), copy.ToString());
- Assert.Equal(0, msg.ToString().Length);
+ Assert.AreEqual(msg.ToString(), copy.ToString());
+ Assert.AreEqual(0, msg.ToString().Length);
msg = msg.ToBuilder().SetOptionalInt32(-1).Build();
- Assert.Equal("optional_int32: -1", msg.ToString().TrimEnd());
+ Assert.AreEqual("optional_int32: -1", msg.ToString().TrimEnd());
msg = msg.ToBuilder().SetOptionalString("abc123").Build();
- Assert.Equal("optional_int32: -1\noptional_string: \"abc123\"",
+ Assert.AreEqual("optional_int32: -1\noptional_string: \"abc123\"",
msg.ToString().Replace("\r", "").TrimEnd());
}
- [Fact]
+ [Test]
public void TestAllTypesDefaultedRoundTrip()
{
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
- Assert.True(msg.IsInitialized);
+ Assert.IsTrue(msg.IsInitialized);
TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build();
- Assert.Equal(msg.ToByteArray(), copy.ToByteArray());
+ Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
- [Fact]
+ [Test]
public void TestAllTypesModifiedRoundTrip()
{
TestAllTypesLite msg = TestAllTypesLite.DefaultInstance;
@@ -114,7 +114,7 @@ namespace Google.ProtocolBuffers
.AddRepeatedGroup(TestAllTypesLite.Types.RepeatedGroup.CreateBuilder().SetA('A').Build())
;
TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build();
- Assert.Equal(msg.ToByteArray(), copy.ToByteArray());
+ Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
}
}
} \ No newline at end of file