Commit d26cef62 authored by Jan Tattermusch's avatar Jan Tattermusch

Merge pull request #366 from jskeet/csharp

Convert back to using NUnit, which is now loaded via NuGet.
parents c58b2c66 90c8932f
...@@ -39,13 +39,13 @@ using System.Collections.Generic; ...@@ -39,13 +39,13 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.Descriptors;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class AbstractMessageTest public class AbstractMessageTest
{ {
[Fact] [Test]
public void Clear() public void Clear()
{ {
AbstractMessageWrapper message = AbstractMessageWrapper message =
...@@ -53,7 +53,7 @@ namespace Google.ProtocolBuffers ...@@ -53,7 +53,7 @@ namespace Google.ProtocolBuffers
TestUtil.AssertClear((TestAllTypes) message.WrappedMessage); TestUtil.AssertClear((TestAllTypes) message.WrappedMessage);
} }
[Fact] [Test]
public void Copy() public void Copy()
{ {
AbstractMessageWrapper message = AbstractMessageWrapper message =
...@@ -61,31 +61,31 @@ namespace Google.ProtocolBuffers ...@@ -61,31 +61,31 @@ namespace Google.ProtocolBuffers
TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage); TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage);
} }
[Fact] [Test]
public void CreateAndBuild() public void CreateAndBuild()
{ {
TestAllTypes.CreateBuilder() TestAllTypes.CreateBuilder()
.Build(); .Build();
} }
[Fact] [Test]
public void SerializedSize() public void SerializedSize()
{ {
TestAllTypes message = TestUtil.GetAllSet(); TestAllTypes message = TestUtil.GetAllSet();
IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet()); IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet());
Assert.Equal(message.SerializedSize, abstractMessage.SerializedSize); Assert.AreEqual(message.SerializedSize, abstractMessage.SerializedSize);
} }
[Fact] [Test]
public void Serialization() public void Serialization()
{ {
IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet()); IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet());
TestUtil.AssertAllFieldsSet(TestAllTypes.ParseFrom(abstractMessage.ToByteString())); TestUtil.AssertAllFieldsSet(TestAllTypes.ParseFrom(abstractMessage.ToByteString()));
Assert.Equal(TestUtil.GetAllSet().ToByteString(), abstractMessage.ToByteString()); Assert.AreEqual(TestUtil.GetAllSet().ToByteString(), abstractMessage.ToByteString());
} }
[Fact] [Test]
public void Parsing() public void Parsing()
{ {
IBuilder builder = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder()); IBuilder builder = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder());
...@@ -94,15 +94,15 @@ namespace Google.ProtocolBuffers ...@@ -94,15 +94,15 @@ namespace Google.ProtocolBuffers
TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage); TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage);
} }
[Fact] [Test]
public void PackedSerialization() public void PackedSerialization()
{ {
IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetPackedSet()); IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetPackedSet());
TestUtil.AssertPackedFieldsSet(TestPackedTypes.ParseFrom(abstractMessage.ToByteString())); TestUtil.AssertPackedFieldsSet(TestPackedTypes.ParseFrom(abstractMessage.ToByteString()));
Assert.Equal(TestUtil.GetPackedSet().ToByteString(), abstractMessage.ToByteString()); Assert.AreEqual(TestUtil.GetPackedSet().ToByteString(), abstractMessage.ToByteString());
} }
[Fact] [Test]
public void PackedParsing() public void PackedParsing()
{ {
AbstractMessageWrapper.Builder builder = new AbstractMessageWrapper.Builder(TestPackedTypes.CreateBuilder()); AbstractMessageWrapper.Builder builder = new AbstractMessageWrapper.Builder(TestPackedTypes.CreateBuilder());
...@@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers ...@@ -110,7 +110,7 @@ namespace Google.ProtocolBuffers
TestUtil.AssertPackedFieldsSet((TestPackedTypes)message.WrappedMessage); TestUtil.AssertPackedFieldsSet((TestPackedTypes)message.WrappedMessage);
} }
[Fact] [Test]
public void UnpackedParsingOfPackedInput() public void UnpackedParsingOfPackedInput()
{ {
byte[] bytes = TestUtil.GetPackedSet().ToByteArray(); byte[] bytes = TestUtil.GetPackedSet().ToByteArray();
...@@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers ...@@ -118,7 +118,7 @@ namespace Google.ProtocolBuffers
TestUtil.AssertUnpackedFieldsSet(message); TestUtil.AssertUnpackedFieldsSet(message);
} }
[Fact] [Test]
public void PackedParsingOfUnpackedInput() public void PackedParsingOfUnpackedInput()
{ {
byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray(); byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray();
...@@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers ...@@ -126,7 +126,7 @@ namespace Google.ProtocolBuffers
TestUtil.AssertPackedFieldsSet(message); TestUtil.AssertPackedFieldsSet(message);
} }
[Fact] [Test]
public void UnpackedParsingOfPackedInputExtensions() public void UnpackedParsingOfPackedInputExtensions()
{ {
byte[] bytes = TestUtil.GetPackedSet().ToByteArray(); byte[] bytes = TestUtil.GetPackedSet().ToByteArray();
...@@ -137,7 +137,7 @@ namespace Google.ProtocolBuffers ...@@ -137,7 +137,7 @@ namespace Google.ProtocolBuffers
TestUtil.AssertUnpackedExtensionsSet(message); TestUtil.AssertUnpackedExtensionsSet(message);
} }
[Fact] [Test]
public void PackedParsingOfUnpackedInputExtensions() public void PackedParsingOfUnpackedInputExtensions()
{ {
byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray(); byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray();
...@@ -147,13 +147,13 @@ namespace Google.ProtocolBuffers ...@@ -147,13 +147,13 @@ namespace Google.ProtocolBuffers
TestUtil.AssertPackedExtensionsSet(message); TestUtil.AssertPackedExtensionsSet(message);
} }
[Fact] [Test]
public void OptimizedForSize() public void OptimizedForSize()
{ {
// We're mostly only Checking that this class was compiled successfully. // We're mostly only Checking that this class was compiled successfully.
TestOptimizedForSize message = TestOptimizedForSize.CreateBuilder().SetI(1).Build(); TestOptimizedForSize message = TestOptimizedForSize.CreateBuilder().SetI(1).Build();
message = TestOptimizedForSize.ParseFrom(message.ToByteString()); message = TestOptimizedForSize.ParseFrom(message.ToByteString());
Assert.Equal(2, message.SerializedSize); Assert.AreEqual(2, message.SerializedSize);
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
...@@ -164,40 +164,40 @@ namespace Google.ProtocolBuffers ...@@ -164,40 +164,40 @@ namespace Google.ProtocolBuffers
private static readonly TestRequired TestRequiredInitialized = private static readonly TestRequired TestRequiredInitialized =
TestRequired.CreateBuilder().SetA(1).SetB(2).SetC(3).Build(); TestRequired.CreateBuilder().SetA(1).SetB(2).SetC(3).Build();
[Fact] [Test]
public void IsInitialized() public void IsInitialized()
{ {
TestRequired.Builder builder = TestRequired.CreateBuilder(); TestRequired.Builder builder = TestRequired.CreateBuilder();
AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder); AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder);
Assert.False(abstractBuilder.IsInitialized); Assert.IsFalse(abstractBuilder.IsInitialized);
builder.A = 1; builder.A = 1;
Assert.False(abstractBuilder.IsInitialized); Assert.IsFalse(abstractBuilder.IsInitialized);
builder.B = 1; builder.B = 1;
Assert.False(abstractBuilder.IsInitialized); Assert.IsFalse(abstractBuilder.IsInitialized);
builder.C = 1; builder.C = 1;
Assert.True(abstractBuilder.IsInitialized); Assert.IsTrue(abstractBuilder.IsInitialized);
} }
[Fact] [Test]
public void ForeignIsInitialized() public void ForeignIsInitialized()
{ {
TestRequiredForeign.Builder builder = TestRequiredForeign.CreateBuilder(); TestRequiredForeign.Builder builder = TestRequiredForeign.CreateBuilder();
AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder); AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder);
Assert.True(abstractBuilder.IsInitialized); Assert.IsTrue(abstractBuilder.IsInitialized);
builder.SetOptionalMessage(TestRequiredUninitialized); builder.SetOptionalMessage(TestRequiredUninitialized);
Assert.False(abstractBuilder.IsInitialized); Assert.IsFalse(abstractBuilder.IsInitialized);
builder.SetOptionalMessage(TestRequiredInitialized); builder.SetOptionalMessage(TestRequiredInitialized);
Assert.True(abstractBuilder.IsInitialized); Assert.IsTrue(abstractBuilder.IsInitialized);
builder.AddRepeatedMessage(TestRequiredUninitialized); builder.AddRepeatedMessage(TestRequiredUninitialized);
Assert.False(abstractBuilder.IsInitialized); Assert.IsFalse(abstractBuilder.IsInitialized);
builder.SetRepeatedMessage(0, TestRequiredInitialized); builder.SetRepeatedMessage(0, TestRequiredInitialized);
Assert.True(abstractBuilder.IsInitialized); Assert.IsTrue(abstractBuilder.IsInitialized);
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
...@@ -226,7 +226,7 @@ namespace Google.ProtocolBuffers ...@@ -226,7 +226,7 @@ namespace Google.ProtocolBuffers
"repeated_string: \"qux\"\n" + "repeated_string: \"qux\"\n" +
"repeated_string: \"bar\"\n"; "repeated_string: \"bar\"\n";
[Fact] [Test]
public void MergeFrom() public void MergeFrom()
{ {
AbstractMessageWrapper result = (AbstractMessageWrapper) AbstractMessageWrapper result = (AbstractMessageWrapper)
...@@ -234,13 +234,13 @@ namespace Google.ProtocolBuffers ...@@ -234,13 +234,13 @@ namespace Google.ProtocolBuffers
.MergeFrom(MergeSource) .MergeFrom(MergeSource)
.Build(); .Build();
Assert.Equal(MergeResultText, result.ToString()); Assert.AreEqual(MergeResultText, result.ToString());
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Tests for equals and hashCode // Tests for equals and hashCode
[Fact] [Test]
public void EqualsAndHashCode() public void EqualsAndHashCode()
{ {
TestAllTypes a = TestUtil.GetAllSet(); TestAllTypes a = TestUtil.GetAllSet();
...@@ -296,7 +296,7 @@ namespace Google.ProtocolBuffers ...@@ -296,7 +296,7 @@ namespace Google.ProtocolBuffers
private static void CheckEqualsIsConsistent(IMessage message) private static void CheckEqualsIsConsistent(IMessage message)
{ {
// Object should be equal to itself. // Object should be equal to itself.
Assert.Equal(message, message); Assert.AreEqual(message, message);
// Object should be equal to a dynamic copy of itself. // Object should be equal to a dynamic copy of itself.
DynamicMessage dynamic = DynamicMessage.CreateBuilder(message).Build(); DynamicMessage dynamic = DynamicMessage.CreateBuilder(message).Build();
...@@ -310,9 +310,9 @@ namespace Google.ProtocolBuffers ...@@ -310,9 +310,9 @@ namespace Google.ProtocolBuffers
{ {
// Not using Assert.AreEqual as that checks for type equality, which isn't // Not using Assert.AreEqual as that checks for type equality, which isn't
// what we want bearing in mind the dynamic message checks. // what we want bearing in mind the dynamic message checks.
Assert.True(message1.Equals(message2)); Assert.IsTrue(message1.Equals(message2));
Assert.True(message2.Equals(message1)); Assert.IsTrue(message2.Equals(message1));
Assert.Equal(message2.GetHashCode(), message1.GetHashCode()); Assert.AreEqual(message2.GetHashCode(), message1.GetHashCode());
} }
/// <summary> /// <summary>
...@@ -326,10 +326,10 @@ namespace Google.ProtocolBuffers ...@@ -326,10 +326,10 @@ namespace Google.ProtocolBuffers
private static void CheckNotEqual(IMessage m1, IMessage m2) private static void CheckNotEqual(IMessage m1, IMessage m2)
{ {
String equalsError = string.Format("{0} should not be equal to {1}", m1, m2); String equalsError = string.Format("{0} should not be equal to {1}", m1, m2);
Assert.False(m1.Equals(m2), equalsError); Assert.IsFalse(m1.Equals(m2), equalsError);
Assert.False(m2.Equals(m1), equalsError); Assert.IsFalse(m2.Equals(m1), equalsError);
Assert.False(m1.GetHashCode() == m2.GetHashCode(), Assert.IsFalse(m1.GetHashCode() == m2.GetHashCode(),
string.Format("{0} should have a different hash code from {1}", m1, m2)); string.Format("{0} should have a different hash code from {1}", m1, m2));
} }
......
...@@ -36,112 +36,112 @@ ...@@ -36,112 +36,112 @@
using System; using System;
using System.Text; using System.Text;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class ByteStringTest public class ByteStringTest
{ {
[Fact] [Test]
public void EmptyByteStringHasZeroSize() public void EmptyByteStringHasZeroSize()
{ {
Assert.Equal(0, ByteString.Empty.Length); Assert.AreEqual(0, ByteString.Empty.Length);
} }
[Fact] [Test]
public void CopyFromStringWithExplicitEncoding() public void CopyFromStringWithExplicitEncoding()
{ {
ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode);
Assert.Equal(4, bs.Length); Assert.AreEqual(4, bs.Length);
Assert.Equal(65, bs[0]); Assert.AreEqual(65, bs[0]);
Assert.Equal(0, bs[1]); Assert.AreEqual(0, bs[1]);
Assert.Equal(66, bs[2]); Assert.AreEqual(66, bs[2]);
Assert.Equal(0, bs[3]); Assert.AreEqual(0, bs[3]);
} }
[Fact] [Test]
public void IsEmptyWhenEmpty() public void IsEmptyWhenEmpty()
{ {
Assert.True(ByteString.CopyFromUtf8("").IsEmpty); Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty);
} }
[Fact] [Test]
public void IsEmptyWhenNotEmpty() public void IsEmptyWhenNotEmpty()
{ {
Assert.False(ByteString.CopyFromUtf8("X").IsEmpty); Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty);
} }
[Fact] [Test]
public void CopyFromByteArrayCopiesContents() public void CopyFromByteArrayCopiesContents()
{ {
byte[] data = new byte[1]; byte[] data = new byte[1];
data[0] = 10; data[0] = 10;
ByteString bs = ByteString.CopyFrom(data); ByteString bs = ByteString.CopyFrom(data);
Assert.Equal(10, bs[0]); Assert.AreEqual(10, bs[0]);
data[0] = 5; data[0] = 5;
Assert.Equal(10, bs[0]); Assert.AreEqual(10, bs[0]);
} }
[Fact] [Test]
public void ToByteArrayCopiesContents() public void ToByteArrayCopiesContents()
{ {
ByteString bs = ByteString.CopyFromUtf8("Hello"); ByteString bs = ByteString.CopyFromUtf8("Hello");
byte[] data = bs.ToByteArray(); byte[] data = bs.ToByteArray();
Assert.Equal((byte)'H', data[0]); Assert.AreEqual((byte)'H', data[0]);
Assert.Equal((byte)'H', bs[0]); Assert.AreEqual((byte)'H', bs[0]);
data[0] = 0; data[0] = 0;
Assert.Equal(0, data[0]); Assert.AreEqual(0, data[0]);
Assert.Equal((byte)'H', bs[0]); Assert.AreEqual((byte)'H', bs[0]);
} }
[Fact] [Test]
public void CopyFromUtf8UsesUtf8() public void CopyFromUtf8UsesUtf8()
{ {
ByteString bs = ByteString.CopyFromUtf8("\u20ac"); ByteString bs = ByteString.CopyFromUtf8("\u20ac");
Assert.Equal(3, bs.Length); Assert.AreEqual(3, bs.Length);
Assert.Equal(0xe2, bs[0]); Assert.AreEqual(0xe2, bs[0]);
Assert.Equal(0x82, bs[1]); Assert.AreEqual(0x82, bs[1]);
Assert.Equal(0xac, bs[2]); Assert.AreEqual(0xac, bs[2]);
} }
[Fact] [Test]
public void CopyFromPortion() public void CopyFromPortion()
{ {
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
ByteString bs = ByteString.CopyFrom(data, 2, 3); ByteString bs = ByteString.CopyFrom(data, 2, 3);
Assert.Equal(3, bs.Length); Assert.AreEqual(3, bs.Length);
Assert.Equal(2, bs[0]); Assert.AreEqual(2, bs[0]);
Assert.Equal(3, bs[1]); Assert.AreEqual(3, bs[1]);
} }
[Fact] [Test]
public void ToStringUtf8() public void ToStringUtf8()
{ {
ByteString bs = ByteString.CopyFromUtf8("\u20ac"); ByteString bs = ByteString.CopyFromUtf8("\u20ac");
Assert.Equal("\u20ac", bs.ToStringUtf8()); Assert.AreEqual("\u20ac", bs.ToStringUtf8());
} }
[Fact] [Test]
public void ToStringWithExplicitEncoding() public void ToStringWithExplicitEncoding()
{ {
ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode);
Assert.Equal("\u20ac", bs.ToString(Encoding.Unicode)); Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode));
} }
[Fact] [Test]
public void FromBase64_WithText() public void FromBase64_WithText()
{ {
byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6};
string base64 = Convert.ToBase64String(data); string base64 = Convert.ToBase64String(data);
ByteString bs = ByteString.FromBase64(base64); ByteString bs = ByteString.FromBase64(base64);
Assert.Equal(data, bs.ToByteArray()); Assert.AreEqual(data, bs.ToByteArray());
} }
[Fact] [Test]
public void FromBase64_Empty() public void FromBase64_Empty()
{ {
// Optimization which also fixes issue 61. // Optimization which also fixes issue 61.
Assert.Same(ByteString.Empty, ByteString.FromBase64("")); Assert.AreSame(ByteString.Empty, ByteString.FromBase64(""));
} }
} }
} }
\ No newline at end of file
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers.Collections namespace Google.ProtocolBuffers.Collections
{ {
public class PopsicleListTest public class PopsicleListTest
{ {
[Fact] [Test]
public void MutatingOperationsOnFrozenList() public void MutatingOperationsOnFrozenList()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
...@@ -55,20 +55,20 @@ namespace Google.ProtocolBuffers.Collections ...@@ -55,20 +55,20 @@ namespace Google.ProtocolBuffers.Collections
Assert.Throws<NotSupportedException>(() => list.Add(new[] { "", "" })); Assert.Throws<NotSupportedException>(() => list.Add(new[] { "", "" }));
} }
[Fact] [Test]
public void NonMutatingOperationsOnFrozenList() public void NonMutatingOperationsOnFrozenList()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
list.MakeReadOnly(); list.MakeReadOnly();
Assert.False(list.Contains("")); Assert.IsFalse(list.Contains(""));
Assert.Equal(0, list.Count); Assert.AreEqual(0, list.Count);
list.CopyTo(new string[5], 0); list.CopyTo(new string[5], 0);
list.GetEnumerator(); list.GetEnumerator();
Assert.Equal(-1, list.IndexOf("")); Assert.AreEqual(-1, list.IndexOf(""));
Assert.True(list.IsReadOnly); Assert.IsTrue(list.IsReadOnly);
} }
[Fact] [Test]
public void MutatingOperationsOnFluidList() public void MutatingOperationsOnFluidList()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
...@@ -80,26 +80,26 @@ namespace Google.ProtocolBuffers.Collections ...@@ -80,26 +80,26 @@ namespace Google.ProtocolBuffers.Collections
list.RemoveAt(0); list.RemoveAt(0);
} }
[Fact] [Test]
public void NonMutatingOperationsOnFluidList() public void NonMutatingOperationsOnFluidList()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
Assert.False(list.Contains("")); Assert.IsFalse(list.Contains(""));
Assert.Equal(0, list.Count); Assert.AreEqual(0, list.Count);
list.CopyTo(new string[5], 0); list.CopyTo(new string[5], 0);
list.GetEnumerator(); list.GetEnumerator();
Assert.Equal(-1, list.IndexOf("")); Assert.AreEqual(-1, list.IndexOf(""));
Assert.False(list.IsReadOnly); Assert.IsFalse(list.IsReadOnly);
} }
[Fact] [Test]
public void DoesNotAddNullEnumerable() public void DoesNotAddNullEnumerable()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
Assert.Throws<ArgumentNullException>(() => list.Add((IEnumerable<string>) null)); Assert.Throws<ArgumentNullException>(() => list.Add((IEnumerable<string>) null));
} }
[Fact] [Test]
public void DoesNotAddRangeWithNull() public void DoesNotAddRangeWithNull()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
...@@ -107,14 +107,14 @@ namespace Google.ProtocolBuffers.Collections ...@@ -107,14 +107,14 @@ namespace Google.ProtocolBuffers.Collections
Assert.Throws<ArgumentNullException>(() => list.Add(new[] {"a", "b", null})); Assert.Throws<ArgumentNullException>(() => list.Add(new[] {"a", "b", null}));
} }
[Fact] [Test]
public void DoesNotAddNull() public void DoesNotAddNull()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
Assert.Throws<ArgumentNullException>(() => list.Add((string) null)); Assert.Throws<ArgumentNullException>(() => list.Add((string) null));
} }
[Fact] [Test]
public void DoesNotSetNull() public void DoesNotSetNull()
{ {
PopsicleList<string> list = new PopsicleList<string>(); PopsicleList<string> list = new PopsicleList<string>();
......
using System; using System;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
/// <summary> /// <summary>
/// This abstract base implements several tests to ensure that well-known messages can be written /// This abstract base implements several tests to ensure that well-known messages can be written
/// and read to/from various formats without losing data. Implementations overload the two serailization /// and read to/from various formats without losing data. Implementations override the two serialization
/// methods to provide the tests with the means to read and write for a given format. /// methods to provide the tests with the means to read and write for a given format.
/// </summary> /// </summary>
public abstract class CompatibilityTests public abstract class CompatibilityTests
...@@ -22,10 +22,10 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -22,10 +22,10 @@ namespace Google.ProtocolBuffers.Compatibility
protected virtual void AssertOutputEquals(object lhs, object rhs) protected virtual void AssertOutputEquals(object lhs, object rhs)
{ {
Assert.Equal<object>(lhs, rhs); Assert.AreEqual(lhs, rhs);
} }
[Fact] [Test]
public virtual void RoundTripWithEmptyChildMessageSize() public virtual void RoundTripWithEmptyChildMessageSize()
{ {
SizeMessage1 msg = SizeMessage1.CreateBuilder() SizeMessage1 msg = SizeMessage1.CreateBuilder()
...@@ -37,12 +37,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -37,12 +37,12 @@ namespace Google.ProtocolBuffers.Compatibility
SizeMessage1 copy = DeserializeMessage<SizeMessage1, SizeMessage1.Builder>(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial(); SizeMessage1 copy = DeserializeMessage<SizeMessage1, SizeMessage1.Builder>(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SizeMessage1, SizeMessage1.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SizeMessage1, SizeMessage1.Builder>(copy));
Assert.Equal(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public virtual void RoundTripWithEmptyChildMessageSpeed() public virtual void RoundTripWithEmptyChildMessageSpeed()
{ {
SpeedMessage1 msg = SpeedMessage1.CreateBuilder() SpeedMessage1 msg = SpeedMessage1.CreateBuilder()
...@@ -54,12 +54,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -54,12 +54,12 @@ namespace Google.ProtocolBuffers.Compatibility
SpeedMessage1 copy = DeserializeMessage<SpeedMessage1, SpeedMessage1.Builder>(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial(); SpeedMessage1 copy = DeserializeMessage<SpeedMessage1, SpeedMessage1.Builder>(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SpeedMessage1, SpeedMessage1.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SpeedMessage1, SpeedMessage1.Builder>(copy));
Assert.Equal(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public virtual void RoundTripMessage1OptimizeSize() public virtual void RoundTripMessage1OptimizeSize()
{ {
SizeMessage1 msg = SizeMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build(); SizeMessage1 msg = SizeMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build();
...@@ -67,12 +67,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -67,12 +67,12 @@ namespace Google.ProtocolBuffers.Compatibility
SizeMessage1 copy = DeserializeMessage<SizeMessage1, SizeMessage1.Builder>(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build(); SizeMessage1 copy = DeserializeMessage<SizeMessage1, SizeMessage1.Builder>(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SizeMessage1, SizeMessage1.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SizeMessage1, SizeMessage1.Builder>(copy));
Assert.Equal(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public virtual void RoundTripMessage2OptimizeSize() public virtual void RoundTripMessage2OptimizeSize()
{ {
SizeMessage2 msg = SizeMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build(); SizeMessage2 msg = SizeMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build();
...@@ -80,12 +80,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -80,12 +80,12 @@ namespace Google.ProtocolBuffers.Compatibility
SizeMessage2 copy = DeserializeMessage<SizeMessage2, SizeMessage2.Builder>(content, SizeMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build(); SizeMessage2 copy = DeserializeMessage<SizeMessage2, SizeMessage2.Builder>(content, SizeMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SizeMessage2, SizeMessage2.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SizeMessage2, SizeMessage2.Builder>(copy));
Assert.Equal(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public virtual void RoundTripMessage1OptimizeSpeed() public virtual void RoundTripMessage1OptimizeSpeed()
{ {
SpeedMessage1 msg = SpeedMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build(); SpeedMessage1 msg = SpeedMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build();
...@@ -93,12 +93,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -93,12 +93,12 @@ namespace Google.ProtocolBuffers.Compatibility
SpeedMessage1 copy = DeserializeMessage<SpeedMessage1, SpeedMessage1.Builder>(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build(); SpeedMessage1 copy = DeserializeMessage<SpeedMessage1, SpeedMessage1.Builder>(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SpeedMessage1, SpeedMessage1.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SpeedMessage1, SpeedMessage1.Builder>(copy));
Assert.Equal(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public virtual void RoundTripMessage2OptimizeSpeed() public virtual void RoundTripMessage2OptimizeSpeed()
{ {
SpeedMessage2 msg = SpeedMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build(); SpeedMessage2 msg = SpeedMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build();
...@@ -106,9 +106,9 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -106,9 +106,9 @@ namespace Google.ProtocolBuffers.Compatibility
SpeedMessage2 copy = DeserializeMessage<SpeedMessage2, SpeedMessage2.Builder>(content, SpeedMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build(); SpeedMessage2 copy = DeserializeMessage<SpeedMessage2, SpeedMessage2.Builder>(content, SpeedMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<SpeedMessage2, SpeedMessage2.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<SpeedMessage2, SpeedMessage2.Builder>(copy));
Assert.Equal(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray()));
} }
#region Test message builders #region Test message builders
...@@ -185,7 +185,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -185,7 +185,7 @@ namespace Google.ProtocolBuffers.Compatibility
#endregion #endregion
[Fact] [Test]
public void TestRoundTripAllTypes() public void TestRoundTripAllTypes()
{ {
TestAllTypes msg = AddAllTypes(new TestAllTypes.Builder()).Build(); TestAllTypes msg = AddAllTypes(new TestAllTypes.Builder()).Build();
...@@ -193,12 +193,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -193,12 +193,12 @@ namespace Google.ProtocolBuffers.Compatibility
TestAllTypes copy = DeserializeMessage<TestAllTypes, TestAllTypes.Builder>(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); TestAllTypes copy = DeserializeMessage<TestAllTypes, TestAllTypes.Builder>(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<TestAllTypes, TestAllTypes.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<TestAllTypes, TestAllTypes.Builder>(copy));
Assert.Equal(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public void TestRoundTripRepeatedTypes() public void TestRoundTripRepeatedTypes()
{ {
TestAllTypes msg = AddRepeatedTypes(new TestAllTypes.Builder(), 5).Build(); TestAllTypes msg = AddRepeatedTypes(new TestAllTypes.Builder(), 5).Build();
...@@ -206,12 +206,12 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -206,12 +206,12 @@ namespace Google.ProtocolBuffers.Compatibility
TestAllTypes copy = DeserializeMessage<TestAllTypes, TestAllTypes.Builder>(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); TestAllTypes copy = DeserializeMessage<TestAllTypes, TestAllTypes.Builder>(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<TestAllTypes, TestAllTypes.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<TestAllTypes, TestAllTypes.Builder>(copy));
Assert.Equal(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray()));
} }
[Fact] [Test]
public void TestRoundTripPackedTypes() public void TestRoundTripPackedTypes()
{ {
TestPackedTypes msg = AddPackedTypes(new TestPackedTypes.Builder(), 5).Build(); TestPackedTypes msg = AddPackedTypes(new TestPackedTypes.Builder(), 5).Build();
...@@ -219,9 +219,9 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -219,9 +219,9 @@ namespace Google.ProtocolBuffers.Compatibility
TestPackedTypes copy = DeserializeMessage<TestPackedTypes, TestPackedTypes.Builder>(content, TestPackedTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); TestPackedTypes copy = DeserializeMessage<TestPackedTypes, TestPackedTypes.Builder>(content, TestPackedTypes.CreateBuilder(), ExtensionRegistry.Empty).Build();
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
AssertOutputEquals(content, SerializeMessage<TestPackedTypes, TestPackedTypes.Builder>(copy)); AssertOutputEquals(content, SerializeMessage<TestPackedTypes, TestPackedTypes.Builder>(copy));
Assert.Equal(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray()));
} }
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Google.ProtocolBuffers.Serialization; using Google.ProtocolBuffers.Serialization;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
[TestFixture]
public class DictionaryCompatibilityTests : CompatibilityTests public class DictionaryCompatibilityTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
...@@ -25,7 +26,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -25,7 +26,7 @@ namespace Google.ProtocolBuffers.Compatibility
IDictionary<string, object> left = (IDictionary<string, object>)lhs; IDictionary<string, object> left = (IDictionary<string, object>)lhs;
IDictionary<string, object> right = (IDictionary<string, object>)rhs; IDictionary<string, object> right = (IDictionary<string, object>)rhs;
Assert.Equal( Assert.AreEqual(
String.Join(",", new List<string>(left.Keys).ToArray()), String.Join(",", new List<string>(left.Keys).ToArray()),
String.Join(",", new List<string>(right.Keys).ToArray()) String.Join(",", new List<string>(right.Keys).ToArray())
); );
......
using System.IO; using System.IO;
using Google.ProtocolBuffers.Serialization; using Google.ProtocolBuffers.Serialization;
using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
[TestFixture]
public class JsonCompatibilityTests : CompatibilityTests public class JsonCompatibilityTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
...@@ -20,6 +22,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -20,6 +22,7 @@ namespace Google.ProtocolBuffers.Compatibility
} }
} }
[TestFixture]
public class JsonCompatibilityFormattedTests : CompatibilityTests public class JsonCompatibilityFormattedTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
......
using System.IO; using System.IO;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
...@@ -16,7 +16,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -16,7 +16,7 @@ namespace Google.ProtocolBuffers.Compatibility
byte[] bytes = new byte[resource.Length]; byte[] bytes = new byte[resource.Length];
int amtRead = resource.Read(bytes, 0, bytes.Length); int amtRead = resource.Read(bytes, 0, bytes.Length);
Assert.Equal(bytes.Length, amtRead); Assert.AreEqual(bytes.Length, amtRead);
return bytes; return bytes;
} }
} }
...@@ -30,7 +30,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -30,7 +30,7 @@ namespace Google.ProtocolBuffers.Compatibility
Assert.NotNull(resource); Assert.NotNull(resource);
byte[] bytes = new byte[resource.Length]; byte[] bytes = new byte[resource.Length];
int amtRead = resource.Read(bytes, 0, bytes.Length); int amtRead = resource.Read(bytes, 0, bytes.Length);
Assert.Equal(bytes.Length, amtRead); Assert.AreEqual(bytes.Length, amtRead);
return bytes; return bytes;
} }
} }
......
using System.IO; using System.IO;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
[TestFixture]
public class TextCompatibilityTests : CompatibilityTests public class TextCompatibilityTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
...@@ -18,14 +19,14 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -18,14 +19,14 @@ namespace Google.ProtocolBuffers.Compatibility
return builder; return builder;
} }
//This test can take a very long time to run. //This test can take a very long time to run.
[Fact] [Test]
public override void RoundTripMessage2OptimizeSize() public override void RoundTripMessage2OptimizeSize()
{ {
//base.RoundTripMessage2OptimizeSize(); //base.RoundTripMessage2OptimizeSize();
} }
//This test can take a very long time to run. //This test can take a very long time to run.
[Fact] [Test]
public override void RoundTripMessage2OptimizeSpeed() public override void RoundTripMessage2OptimizeSpeed()
{ {
//base.RoundTripMessage2OptimizeSpeed(); //base.RoundTripMessage2OptimizeSpeed();
......
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using Google.ProtocolBuffers.Serialization; using Google.ProtocolBuffers.Serialization;
using NUnit.Framework;
namespace Google.ProtocolBuffers.Compatibility namespace Google.ProtocolBuffers.Compatibility
{ {
[TestFixture]
public class XmlCompatibilityTests : CompatibilityTests public class XmlCompatibilityTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
...@@ -21,6 +23,7 @@ namespace Google.ProtocolBuffers.Compatibility ...@@ -21,6 +23,7 @@ namespace Google.ProtocolBuffers.Compatibility
} }
} }
[TestFixture]
public class XmlCompatibilityFormattedTests : CompatibilityTests public class XmlCompatibilityFormattedTests : CompatibilityTests
{ {
protected override object SerializeMessage<TMessage, TBuilder>(TMessage message) protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
......
using System; using System;
using System.Reflection; using System.Reflection;
using UnitTest.Issues.TestProtos; using UnitTest.Issues.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
...@@ -10,10 +10,10 @@ namespace Google.ProtocolBuffers ...@@ -10,10 +10,10 @@ namespace Google.ProtocolBuffers
private static void AssertIsDeprecated(MemberInfo member) private static void AssertIsDeprecated(MemberInfo member)
{ {
Assert.NotNull(member); Assert.NotNull(member);
Assert.True(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member);
} }
[Fact] [Test]
public void TestDepreatedPrimitiveValue() public void TestDepreatedPrimitiveValue()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasPrimitiveValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasPrimitiveValue"));
...@@ -24,7 +24,7 @@ namespace Google.ProtocolBuffers ...@@ -24,7 +24,7 @@ namespace Google.ProtocolBuffers
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveValue"));
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveValue"));
} }
[Fact] [Test]
public void TestDepreatedPrimitiveArray() public void TestDepreatedPrimitiveArray()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayList")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayList"));
...@@ -39,7 +39,7 @@ namespace Google.ProtocolBuffers ...@@ -39,7 +39,7 @@ namespace Google.ProtocolBuffers
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangePrimitiveArray")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangePrimitiveArray"));
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveArray")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveArray"));
} }
[Fact] [Test]
public void TestDepreatedMessageValue() public void TestDepreatedMessageValue()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasMessageValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasMessageValue"));
...@@ -52,7 +52,7 @@ namespace Google.ProtocolBuffers ...@@ -52,7 +52,7 @@ namespace Google.ProtocolBuffers
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild) })); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild) }));
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild.Builder) })); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild.Builder) }));
} }
[Fact] [Test]
public void TestDepreatedMessageArray() public void TestDepreatedMessageArray()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayList")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayList"));
...@@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers ...@@ -69,7 +69,7 @@ namespace Google.ProtocolBuffers
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeMessageArray")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeMessageArray"));
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageArray")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageArray"));
} }
[Fact] [Test]
public void TestDepreatedEnumValue() public void TestDepreatedEnumValue()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasEnumValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasEnumValue"));
...@@ -80,7 +80,7 @@ namespace Google.ProtocolBuffers ...@@ -80,7 +80,7 @@ namespace Google.ProtocolBuffers
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumValue"));
AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumValue")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumValue"));
} }
[Fact] [Test]
public void TestDepreatedEnumArray() public void TestDepreatedEnumArray()
{ {
AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayList")); AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayList"));
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
...@@ -54,7 +54,7 @@ namespace Google.ProtocolBuffers ...@@ -54,7 +54,7 @@ namespace Google.ProtocolBuffers
packedReflectionTester = ReflectionTester.CreateTestPackedTypesInstance(); packedReflectionTester = ReflectionTester.CreateTestPackedTypesInstance();
} }
[Fact] [Test]
public void DynamicMessageAccessors() public void DynamicMessageAccessors()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
...@@ -63,7 +63,7 @@ namespace Google.ProtocolBuffers ...@@ -63,7 +63,7 @@ namespace Google.ProtocolBuffers
reflectionTester.AssertAllFieldsSetViaReflection(message); reflectionTester.AssertAllFieldsSetViaReflection(message);
} }
[Fact] [Test]
public void DoubleBuildError() public void DoubleBuildError()
{ {
DynamicMessage.Builder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); DynamicMessage.Builder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
...@@ -71,14 +71,14 @@ namespace Google.ProtocolBuffers ...@@ -71,14 +71,14 @@ namespace Google.ProtocolBuffers
Assert.Throws<InvalidOperationException>(() => builder.Build()); Assert.Throws<InvalidOperationException>(() => builder.Build());
} }
[Fact] [Test]
public void DynamicMessageSettersRejectNull() public void DynamicMessageSettersRejectNull()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
reflectionTester.AssertReflectionSettersRejectNull(builder); reflectionTester.AssertReflectionSettersRejectNull(builder);
} }
[Fact] [Test]
public void DynamicMessageExtensionAccessors() public void DynamicMessageExtensionAccessors()
{ {
// We don't need to extensively test DynamicMessage's handling of // We don't need to extensively test DynamicMessage's handling of
...@@ -90,14 +90,14 @@ namespace Google.ProtocolBuffers ...@@ -90,14 +90,14 @@ namespace Google.ProtocolBuffers
extensionsReflectionTester.AssertAllFieldsSetViaReflection(message); extensionsReflectionTester.AssertAllFieldsSetViaReflection(message);
} }
[Fact] [Test]
public void DynamicMessageExtensionSettersRejectNull() public void DynamicMessageExtensionSettersRejectNull()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllExtensions.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllExtensions.Descriptor);
extensionsReflectionTester.AssertReflectionSettersRejectNull(builder); extensionsReflectionTester.AssertReflectionSettersRejectNull(builder);
} }
[Fact] [Test]
public void DynamicMessageRepeatedSetters() public void DynamicMessageRepeatedSetters()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
...@@ -107,21 +107,21 @@ namespace Google.ProtocolBuffers ...@@ -107,21 +107,21 @@ namespace Google.ProtocolBuffers
reflectionTester.AssertRepeatedFieldsModifiedViaReflection(message); reflectionTester.AssertRepeatedFieldsModifiedViaReflection(message);
} }
[Fact] [Test]
public void DynamicMessageRepeatedSettersRejectNull() public void DynamicMessageRepeatedSettersRejectNull()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
reflectionTester.AssertReflectionRepeatedSettersRejectNull(builder); reflectionTester.AssertReflectionRepeatedSettersRejectNull(builder);
} }
[Fact] [Test]
public void DynamicMessageDefaults() public void DynamicMessageDefaults()
{ {
reflectionTester.AssertClearViaReflection(DynamicMessage.GetDefaultInstance(TestAllTypes.Descriptor)); reflectionTester.AssertClearViaReflection(DynamicMessage.GetDefaultInstance(TestAllTypes.Descriptor));
reflectionTester.AssertClearViaReflection(DynamicMessage.CreateBuilder(TestAllTypes.Descriptor).Build()); reflectionTester.AssertClearViaReflection(DynamicMessage.CreateBuilder(TestAllTypes.Descriptor).Build());
} }
[Fact] [Test]
public void DynamicMessageSerializedSize() public void DynamicMessageSerializedSize()
{ {
TestAllTypes message = TestUtil.GetAllSet(); TestAllTypes message = TestUtil.GetAllSet();
...@@ -130,10 +130,10 @@ namespace Google.ProtocolBuffers ...@@ -130,10 +130,10 @@ namespace Google.ProtocolBuffers
reflectionTester.SetAllFieldsViaReflection(dynamicBuilder); reflectionTester.SetAllFieldsViaReflection(dynamicBuilder);
IMessage dynamicMessage = dynamicBuilder.WeakBuild(); IMessage dynamicMessage = dynamicBuilder.WeakBuild();
Assert.Equal(message.SerializedSize, dynamicMessage.SerializedSize); Assert.AreEqual(message.SerializedSize, dynamicMessage.SerializedSize);
} }
[Fact] [Test]
public void DynamicMessageSerialization() public void DynamicMessageSerialization()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor);
...@@ -146,10 +146,10 @@ namespace Google.ProtocolBuffers ...@@ -146,10 +146,10 @@ namespace Google.ProtocolBuffers
TestUtil.AssertAllFieldsSet(message2); TestUtil.AssertAllFieldsSet(message2);
// In fact, the serialized forms should be exactly the same, byte-for-byte. // In fact, the serialized forms should be exactly the same, byte-for-byte.
Assert.Equal(TestUtil.GetAllSet().ToByteString(), rawBytes); Assert.AreEqual(TestUtil.GetAllSet().ToByteString(), rawBytes);
} }
[Fact] [Test]
public void DynamicMessageParsing() public void DynamicMessageParsing()
{ {
TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();
...@@ -162,7 +162,7 @@ namespace Google.ProtocolBuffers ...@@ -162,7 +162,7 @@ namespace Google.ProtocolBuffers
reflectionTester.AssertAllFieldsSetViaReflection(message2); reflectionTester.AssertAllFieldsSetViaReflection(message2);
} }
[Fact] [Test]
public void DynamicMessagePackedSerialization() public void DynamicMessagePackedSerialization()
{ {
IBuilder builder = DynamicMessage.CreateBuilder(TestPackedTypes.Descriptor); IBuilder builder = DynamicMessage.CreateBuilder(TestPackedTypes.Descriptor);
...@@ -175,10 +175,10 @@ namespace Google.ProtocolBuffers ...@@ -175,10 +175,10 @@ namespace Google.ProtocolBuffers
TestUtil.AssertPackedFieldsSet(message2); TestUtil.AssertPackedFieldsSet(message2);
// In fact, the serialized forms should be exactly the same, byte-for-byte. // In fact, the serialized forms should be exactly the same, byte-for-byte.
Assert.Equal(TestUtil.GetPackedSet().ToByteString(), rawBytes); Assert.AreEqual(TestUtil.GetPackedSet().ToByteString(), rawBytes);
} }
[Fact] [Test]
public void DynamicMessagePackedParsing() public void DynamicMessagePackedParsing()
{ {
TestPackedTypes.Builder builder = TestPackedTypes.CreateBuilder(); TestPackedTypes.Builder builder = TestPackedTypes.CreateBuilder();
...@@ -191,7 +191,7 @@ namespace Google.ProtocolBuffers ...@@ -191,7 +191,7 @@ namespace Google.ProtocolBuffers
packedReflectionTester.AssertPackedFieldsSetViaReflection(message2); packedReflectionTester.AssertPackedFieldsSetViaReflection(message2);
} }
[Fact] [Test]
public void DynamicMessageCopy() public void DynamicMessageCopy()
{ {
TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();
...@@ -202,7 +202,7 @@ namespace Google.ProtocolBuffers ...@@ -202,7 +202,7 @@ namespace Google.ProtocolBuffers
reflectionTester.AssertAllFieldsSetViaReflection(copy); reflectionTester.AssertAllFieldsSetViaReflection(copy);
} }
[Fact] [Test]
public void ToBuilder() public void ToBuilder()
{ {
DynamicMessage.Builder builder = DynamicMessage.Builder builder =
...@@ -220,8 +220,8 @@ namespace Google.ProtocolBuffers ...@@ -220,8 +220,8 @@ namespace Google.ProtocolBuffers
reflectionTester.AssertAllFieldsSetViaReflection(derived); reflectionTester.AssertAllFieldsSetViaReflection(derived);
IList<ulong> values = derived.UnknownFields.FieldDictionary[unknownFieldNum].VarintList; IList<ulong> values = derived.UnknownFields.FieldDictionary[unknownFieldNum].VarintList;
Assert.Equal(1, values.Count); Assert.AreEqual(1, values.Count);
Assert.Equal(unknownFieldVal, values[0]); Assert.AreEqual(unknownFieldVal, values[0]);
} }
} }
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
using System; using System;
using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.Descriptors;
using Google.ProtocolBuffers.TestProtos.FieldPresence; using Google.ProtocolBuffers.TestProtos.FieldPresence;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
...@@ -48,7 +48,7 @@ namespace Google.ProtocolBuffers ...@@ -48,7 +48,7 @@ namespace Google.ProtocolBuffers
Assert.Null(proto3Type.GetProperty("Has" + name)); Assert.Null(proto3Type.GetProperty("Has" + name));
} }
[Fact] [Test]
public void TestHasMethod() public void TestHasMethod()
{ {
// Optional non-message fields don't have HasFoo method generated // Optional non-message fields don't have HasFoo method generated
...@@ -67,11 +67,11 @@ namespace Google.ProtocolBuffers ...@@ -67,11 +67,11 @@ namespace Google.ProtocolBuffers
CheckHasMethodRemoved(proto2Type, proto3Type, "OptionalNestedEnum"); CheckHasMethodRemoved(proto2Type, proto3Type, "OptionalNestedEnum");
// message fields still have the HasFoo method generated // message fields still have the HasFoo method generated
Assert.False(TestAllTypes.CreateBuilder().Build().HasOptionalNestedMessage); Assert.IsFalse(TestAllTypes.CreateBuilder().Build().HasOptionalNestedMessage);
Assert.False(TestAllTypes.CreateBuilder().HasOptionalNestedMessage); Assert.IsFalse(TestAllTypes.CreateBuilder().HasOptionalNestedMessage);
} }
[Fact] [Test]
public void TestFieldPresence() public void TestFieldPresence()
{ {
// Optional non-message fields set to their default value are treated the same // Optional non-message fields set to their default value are treated the same
...@@ -84,7 +84,7 @@ namespace Google.ProtocolBuffers ...@@ -84,7 +84,7 @@ namespace Google.ProtocolBuffers
builder.SetOptionalBytes(ByteString.Empty); builder.SetOptionalBytes(ByteString.Empty);
builder.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO); builder.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO);
TestAllTypes message = builder.Build(); TestAllTypes message = builder.Build();
Assert.Equal(0, message.SerializedSize); Assert.AreEqual(0, message.SerializedSize);
// Test merge // Test merge
TestAllTypes.Builder a = TestAllTypes.CreateBuilder(); TestAllTypes.Builder a = TestAllTypes.CreateBuilder();
...@@ -94,19 +94,19 @@ namespace Google.ProtocolBuffers ...@@ -94,19 +94,19 @@ namespace Google.ProtocolBuffers
a.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.BAR); a.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.BAR);
a.MergeFrom(message); a.MergeFrom(message);
TestAllTypes messageA = a.Build(); TestAllTypes messageA = a.Build();
Assert.Equal(1, messageA.OptionalInt32); Assert.AreEqual(1, messageA.OptionalInt32);
Assert.Equal("x", messageA.OptionalString); Assert.AreEqual("x", messageA.OptionalString);
Assert.Equal(ByteString.CopyFromUtf8("y"), messageA.OptionalBytes); Assert.AreEqual(ByteString.CopyFromUtf8("y"), messageA.OptionalBytes);
Assert.Equal(TestAllTypes.Types.NestedEnum.BAR, messageA.OptionalNestedEnum); Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, messageA.OptionalNestedEnum);
// equals/hashCode should produce the same results // equals/hashCode should produce the same results
TestAllTypes empty = TestAllTypes.CreateBuilder().Build(); TestAllTypes empty = TestAllTypes.CreateBuilder().Build();
Assert.True(empty.Equals(message)); Assert.IsTrue(empty.Equals(message));
Assert.True(message.Equals(empty)); Assert.IsTrue(message.Equals(empty));
Assert.Equal(empty.GetHashCode(), message.GetHashCode()); Assert.AreEqual(empty.GetHashCode(), message.GetHashCode());
} }
[Fact] [Test]
public void TestFieldPresenceReflection() public void TestFieldPresenceReflection()
{ {
MessageDescriptor descriptor = TestAllTypes.Descriptor; MessageDescriptor descriptor = TestAllTypes.Descriptor;
...@@ -116,10 +116,10 @@ namespace Google.ProtocolBuffers ...@@ -116,10 +116,10 @@ namespace Google.ProtocolBuffers
FieldDescriptor optionalNestedEnumField = descriptor.FindFieldByName("optional_nested_enum"); FieldDescriptor optionalNestedEnumField = descriptor.FindFieldByName("optional_nested_enum");
TestAllTypes message = TestAllTypes.CreateBuilder().Build(); TestAllTypes message = TestAllTypes.CreateBuilder().Build();
Assert.False(message.HasField(optionalInt32Field)); Assert.IsFalse(message.HasField(optionalInt32Field));
Assert.False(message.HasField(optionalStringField)); Assert.IsFalse(message.HasField(optionalStringField));
Assert.False(message.HasField(optionalBytesField)); Assert.IsFalse(message.HasField(optionalBytesField));
Assert.False(message.HasField(optionalNestedEnumField)); Assert.IsFalse(message.HasField(optionalNestedEnumField));
// Set to default value is seen as not present // Set to default value is seen as not present
message = TestAllTypes.CreateBuilder() message = TestAllTypes.CreateBuilder()
...@@ -128,11 +128,11 @@ namespace Google.ProtocolBuffers ...@@ -128,11 +128,11 @@ namespace Google.ProtocolBuffers
.SetOptionalBytes(ByteString.Empty) .SetOptionalBytes(ByteString.Empty)
.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO) .SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO)
.Build(); .Build();
Assert.False(message.HasField(optionalInt32Field)); Assert.IsFalse(message.HasField(optionalInt32Field));
Assert.False(message.HasField(optionalStringField)); Assert.IsFalse(message.HasField(optionalStringField));
Assert.False(message.HasField(optionalBytesField)); Assert.IsFalse(message.HasField(optionalBytesField));
Assert.False(message.HasField(optionalNestedEnumField)); Assert.IsFalse(message.HasField(optionalNestedEnumField));
Assert.Equal(0, message.AllFields.Count); Assert.AreEqual(0, message.AllFields.Count);
// Set t0 non-defalut value is seen as present // Set t0 non-defalut value is seen as present
message = TestAllTypes.CreateBuilder() message = TestAllTypes.CreateBuilder()
...@@ -141,28 +141,28 @@ namespace Google.ProtocolBuffers ...@@ -141,28 +141,28 @@ namespace Google.ProtocolBuffers
.SetOptionalBytes(ByteString.CopyFromUtf8("y")) .SetOptionalBytes(ByteString.CopyFromUtf8("y"))
.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.BAR) .SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.BAR)
.Build(); .Build();
Assert.True(message.HasField(optionalInt32Field)); Assert.IsTrue(message.HasField(optionalInt32Field));
Assert.True(message.HasField(optionalStringField)); Assert.IsTrue(message.HasField(optionalStringField));
Assert.True(message.HasField(optionalBytesField)); Assert.IsTrue(message.HasField(optionalBytesField));
Assert.True(message.HasField(optionalNestedEnumField)); Assert.IsTrue(message.HasField(optionalNestedEnumField));
Assert.Equal(4, message.AllFields.Count); Assert.AreEqual(4, message.AllFields.Count);
} }
[Fact] [Test]
public void TestMessageField() public void TestMessageField()
{ {
TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();
Assert.False(builder.HasOptionalNestedMessage); Assert.IsFalse(builder.HasOptionalNestedMessage);
Assert.False(builder.Build().HasOptionalNestedMessage); Assert.IsFalse(builder.Build().HasOptionalNestedMessage);
// Unlike non-message fields, if we set default value to message field, the field // Unlike non-message fields, if we set default value to message field, the field
// shoule be seem as present. // shoule be seem as present.
builder.SetOptionalNestedMessage(TestAllTypes.Types.NestedMessage.DefaultInstance); builder.SetOptionalNestedMessage(TestAllTypes.Types.NestedMessage.DefaultInstance);
Assert.True(builder.HasOptionalNestedMessage); Assert.IsTrue(builder.HasOptionalNestedMessage);
Assert.True(builder.Build().HasOptionalNestedMessage); Assert.IsTrue(builder.Build().HasOptionalNestedMessage);
} }
[Fact] [Test]
public void TestSerializeAndParse() public void TestSerializeAndParse()
{ {
TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); TestAllTypes.Builder builder = TestAllTypes.CreateBuilder();
...@@ -172,12 +172,12 @@ namespace Google.ProtocolBuffers ...@@ -172,12 +172,12 @@ namespace Google.ProtocolBuffers
ByteString data = builder.Build().ToByteString(); ByteString data = builder.Build().ToByteString();
TestAllTypes message = TestAllTypes.ParseFrom(data); TestAllTypes message = TestAllTypes.ParseFrom(data);
Assert.Equal(1234, message.OptionalInt32); Assert.AreEqual(1234, message.OptionalInt32);
Assert.Equal("hello", message.OptionalString); Assert.AreEqual("hello", message.OptionalString);
Assert.Equal(ByteString.Empty, message.OptionalBytes); Assert.AreEqual(ByteString.Empty, message.OptionalBytes);
Assert.Equal(TestAllTypes.Types.NestedEnum.FOO, message.OptionalNestedEnum); Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, message.OptionalNestedEnum);
Assert.True(message.HasOptionalNestedMessage); Assert.IsTrue(message.HasOptionalNestedMessage);
Assert.Equal(0, message.OptionalNestedMessage.Value); Assert.AreEqual(0, message.OptionalNestedMessage.Value);
} }
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
...@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers ...@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers
} }
public IEnumerator<T> GetEnumerator() public IEnumerator<T> GetEnumerator()
{ {
Assert.False(_enumerated); Assert.IsFalse(_enumerated);
_enumerated = true; _enumerated = true;
yield return _item; yield return _item;
} }
...@@ -27,49 +27,49 @@ namespace Google.ProtocolBuffers ...@@ -27,49 +27,49 @@ namespace Google.ProtocolBuffers
} }
} }
[Fact] [Test]
public void DoesNotEnumerateTwiceForMessageList() public void DoesNotEnumerateTwiceForMessageList()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
b.AddRangeRepeatedForeignMessage(new OneTimeEnumerator<ForeignMessage>(ForeignMessage.DefaultInstance)); b.AddRangeRepeatedForeignMessage(new OneTimeEnumerator<ForeignMessage>(ForeignMessage.DefaultInstance));
} }
[Fact] [Test]
public void DoesNotEnumerateTwiceForPrimitiveList() public void DoesNotEnumerateTwiceForPrimitiveList()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
b.AddRangeRepeatedInt32(new OneTimeEnumerator<int>(1)); b.AddRangeRepeatedInt32(new OneTimeEnumerator<int>(1));
} }
[Fact] [Test]
public void DoesNotEnumerateTwiceForStringList() public void DoesNotEnumerateTwiceForStringList()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
b.AddRangeRepeatedString(new OneTimeEnumerator<string>("test")); b.AddRangeRepeatedString(new OneTimeEnumerator<string>("test"));
} }
[Fact] [Test]
public void DoesNotEnumerateTwiceForEnumList() public void DoesNotEnumerateTwiceForEnumList()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
b.AddRangeRepeatedForeignEnum(new OneTimeEnumerator<ForeignEnum>(ForeignEnum.FOREIGN_BAR)); b.AddRangeRepeatedForeignEnum(new OneTimeEnumerator<ForeignEnum>(ForeignEnum.FOREIGN_BAR));
} }
[Fact] [Test]
public void DoesNotAddNullToMessageListByAddRange() public void DoesNotAddNullToMessageListByAddRange()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
Assert.Throws<ArgumentNullException>(() => b.AddRangeRepeatedForeignMessage(new ForeignMessage[] { null })); Assert.Throws<ArgumentNullException>(() => b.AddRangeRepeatedForeignMessage(new ForeignMessage[] { null }));
} }
[Fact] [Test]
public void DoesNotAddNullToMessageListByAdd() public void DoesNotAddNullToMessageListByAdd()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
Assert.Throws<ArgumentNullException>(() => b.AddRepeatedForeignMessage((ForeignMessage)null)); Assert.Throws<ArgumentNullException>(() => b.AddRepeatedForeignMessage((ForeignMessage)null));
} }
[Fact] [Test]
public void DoesNotAddNullToMessageListBySet() public void DoesNotAddNullToMessageListBySet()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
...@@ -77,21 +77,21 @@ namespace Google.ProtocolBuffers ...@@ -77,21 +77,21 @@ namespace Google.ProtocolBuffers
Assert.Throws<ArgumentNullException>(() => b.SetRepeatedForeignMessage(0, (ForeignMessage)null)); Assert.Throws<ArgumentNullException>(() => b.SetRepeatedForeignMessage(0, (ForeignMessage)null));
} }
[Fact] [Test]
public void DoesNotAddNullToStringListByAddRange() public void DoesNotAddNullToStringListByAddRange()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
Assert.Throws<ArgumentNullException>(() => b.AddRangeRepeatedString(new String[] { null })); Assert.Throws<ArgumentNullException>(() => b.AddRangeRepeatedString(new String[] { null }));
} }
[Fact] [Test]
public void DoesNotAddNullToStringListByAdd() public void DoesNotAddNullToStringListByAdd()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
Assert.Throws<ArgumentNullException>(() => b.AddRepeatedString(null)); Assert.Throws<ArgumentNullException>(() => b.AddRepeatedString(null));
} }
[Fact] [Test]
public void DoesNotAddNullToStringListBySet() public void DoesNotAddNullToStringListBySet()
{ {
TestAllTypes.Builder b = new TestAllTypes.Builder(); TestAllTypes.Builder b = new TestAllTypes.Builder();
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
using Google.ProtocolBuffers.Descriptors; using Google.ProtocolBuffers.Descriptors;
using UnitTest.Issues.TestProtos; using UnitTest.Issues.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
...@@ -48,13 +48,13 @@ namespace Google.ProtocolBuffers ...@@ -48,13 +48,13 @@ namespace Google.ProtocolBuffers
public class IssuesTest public class IssuesTest
{ {
// Issue 45 // Issue 45
[Fact] [Test]
public void FieldCalledItem() public void FieldCalledItem()
{ {
ItemField message = new ItemField.Builder { Item = 3 }.Build(); ItemField message = new ItemField.Builder { Item = 3 }.Build();
FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
Assert.NotNull(field); Assert.NotNull(field);
Assert.Equal(3, (int)message[field]); Assert.AreEqual(3, (int)message[field]);
} }
} }
} }
...@@ -37,27 +37,27 @@ ...@@ -37,27 +37,27 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage; using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class MessageStreamIteratorTest public class MessageStreamIteratorTest
{ {
[Fact] [Test]
public void ThreeMessagesInMemory() public void ThreeMessagesInMemory()
{ {
MemoryStream stream = new MemoryStream(MessageStreamWriterTest.ThreeMessageData); MemoryStream stream = new MemoryStream(MessageStreamWriterTest.ThreeMessageData);
IEnumerable<NestedMessage> iterator = MessageStreamIterator<NestedMessage>.FromStreamProvider(() => stream); IEnumerable<NestedMessage> iterator = MessageStreamIterator<NestedMessage>.FromStreamProvider(() => stream);
List<NestedMessage> messages = new List<NestedMessage>(iterator); List<NestedMessage> messages = new List<NestedMessage>(iterator);
Assert.Equal(3, messages.Count); Assert.AreEqual(3, messages.Count);
Assert.Equal(5, messages[0].Bb); Assert.AreEqual(5, messages[0].Bb);
Assert.Equal(1500, messages[1].Bb); Assert.AreEqual(1500, messages[1].Bb);
Assert.False(messages[2].HasBb); Assert.IsFalse(messages[2].HasBb);
} }
[Fact] [Test]
public void ManyMessagesShouldNotTriggerSizeAlert() public void ManyMessagesShouldNotTriggerSizeAlert()
{ {
int messageSize = TestUtil.GetAllSet().SerializedSize; int messageSize = TestUtil.GetAllSet().SerializedSize;
...@@ -83,7 +83,7 @@ namespace Google.ProtocolBuffers ...@@ -83,7 +83,7 @@ namespace Google.ProtocolBuffers
count++; count++;
TestUtil.AssertAllFieldsSet(message); TestUtil.AssertAllFieldsSet(message);
} }
Assert.Equal(correctCount, count); Assert.AreEqual(correctCount, count);
} }
} }
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#endregion #endregion
using System.IO; using System.IO;
using Xunit; using NUnit.Framework;
using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage; using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
...@@ -54,7 +54,7 @@ namespace Google.ProtocolBuffers ...@@ -54,7 +54,7 @@ namespace Google.ProtocolBuffers
(1 << 3) | 2, 0, // Field 1, no data (third message) (1 << 3) | 2, 0, // Field 1, no data (third message)
}; };
[Fact] [Test]
public void ThreeMessages() public void ThreeMessages()
{ {
NestedMessage message1 = new NestedMessage.Builder {Bb = 5}.Build(); NestedMessage message1 = new NestedMessage.Builder {Bb = 5}.Build();
......
...@@ -36,47 +36,47 @@ ...@@ -36,47 +36,47 @@
using System; using System;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class MessageUtilTest public class MessageUtilTest
{ {
[Fact] [Test]
public void NullTypeName() public void NullTypeName()
{ {
Assert.Throws<ArgumentNullException>(() => MessageUtil.GetDefaultMessage((string) null)); Assert.Throws<ArgumentNullException>(() => MessageUtil.GetDefaultMessage((string) null));
} }
[Fact] [Test]
public void InvalidTypeName() public void InvalidTypeName()
{ {
Assert.Throws<ArgumentException>(() => MessageUtil.GetDefaultMessage("invalidtypename")); Assert.Throws<ArgumentException>(() => MessageUtil.GetDefaultMessage("invalidtypename"));
} }
[Fact] [Test]
public void ValidTypeName() public void ValidTypeName()
{ {
Assert.Same(TestAllTypes.DefaultInstance, Assert.AreSame(TestAllTypes.DefaultInstance,
MessageUtil.GetDefaultMessage(typeof(TestAllTypes).AssemblyQualifiedName)); MessageUtil.GetDefaultMessage(typeof(TestAllTypes).AssemblyQualifiedName));
} }
[Fact] [Test]
public void NullType() public void NullType()
{ {
Assert.Throws<ArgumentNullException>(() => MessageUtil.GetDefaultMessage((Type)null)); Assert.Throws<ArgumentNullException>(() => MessageUtil.GetDefaultMessage((Type)null));
} }
[Fact] [Test]
public void NonMessageType() public void NonMessageType()
{ {
Assert.Throws<ArgumentException>(() => MessageUtil.GetDefaultMessage(typeof(string))); Assert.Throws<ArgumentException>(() => MessageUtil.GetDefaultMessage(typeof(string)));
} }
[Fact] [Test]
public void ValidType() public void ValidType()
{ {
Assert.Same(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes))); Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes)));
} }
} }
} }
\ No newline at end of file
...@@ -34,48 +34,48 @@ ...@@ -34,48 +34,48 @@
#endregion #endregion
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class NameHelpersTest public class NameHelpersTest
{ {
[Fact] [Test]
public void UnderscoresToPascalCase() public void UnderscoresToPascalCase()
{ {
Assert.Equal("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_bar")); Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_bar"));
Assert.Equal("FooBar", NameHelpers.UnderscoresToPascalCase("foo_bar")); Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("foo_bar"));
Assert.Equal("Foo0Bar", NameHelpers.UnderscoresToPascalCase("Foo0bar")); Assert.AreEqual("Foo0Bar", NameHelpers.UnderscoresToPascalCase("Foo0bar"));
Assert.Equal("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_+_Bar")); Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_+_Bar"));
Assert.Equal("Bar", NameHelpers.UnderscoresToPascalCase("__+bar")); Assert.AreEqual("Bar", NameHelpers.UnderscoresToPascalCase("__+bar"));
Assert.Equal("Bar", NameHelpers.UnderscoresToPascalCase("bar_")); Assert.AreEqual("Bar", NameHelpers.UnderscoresToPascalCase("bar_"));
Assert.Equal("_0Bar", NameHelpers.UnderscoresToPascalCase("_0bar")); Assert.AreEqual("_0Bar", NameHelpers.UnderscoresToPascalCase("_0bar"));
Assert.Equal("_1Bar", NameHelpers.UnderscoresToPascalCase("_1_bar")); Assert.AreEqual("_1Bar", NameHelpers.UnderscoresToPascalCase("_1_bar"));
} }
[Fact] [Test]
public void UnderscoresToCamelCase() public void UnderscoresToCamelCase()
{ {
Assert.Equal("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_bar")); Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_bar"));
Assert.Equal("fooBar", NameHelpers.UnderscoresToCamelCase("foo_bar")); Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("foo_bar"));
Assert.Equal("foo0Bar", NameHelpers.UnderscoresToCamelCase("Foo0bar")); Assert.AreEqual("foo0Bar", NameHelpers.UnderscoresToCamelCase("Foo0bar"));
Assert.Equal("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_+_Bar")); Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_+_Bar"));
Assert.Equal("bar", NameHelpers.UnderscoresToCamelCase("__+bar")); Assert.AreEqual("bar", NameHelpers.UnderscoresToCamelCase("__+bar"));
Assert.Equal("bar", NameHelpers.UnderscoresToCamelCase("bar_")); Assert.AreEqual("bar", NameHelpers.UnderscoresToCamelCase("bar_"));
Assert.Equal("_0Bar", NameHelpers.UnderscoresToCamelCase("_0bar")); Assert.AreEqual("_0Bar", NameHelpers.UnderscoresToCamelCase("_0bar"));
Assert.Equal("_1Bar", NameHelpers.UnderscoresToCamelCase("_1_bar")); Assert.AreEqual("_1Bar", NameHelpers.UnderscoresToCamelCase("_1_bar"));
} }
[Fact] [Test]
public void StripSuffix() public void StripSuffix()
{ {
string text = "FooBar"; string text = "FooBar";
Assert.False(NameHelpers.StripSuffix(ref text, "Foo")); Assert.IsFalse(NameHelpers.StripSuffix(ref text, "Foo"));
Assert.Equal("FooBar", text); Assert.AreEqual("FooBar", text);
Assert.True(NameHelpers.StripSuffix(ref text, "Bar")); Assert.IsTrue(NameHelpers.StripSuffix(ref text, "Bar"));
Assert.Equal("Foo", text); Assert.AreEqual("Foo", text);
} }
} }
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
...@@ -19,7 +17,8 @@ ...@@ -19,7 +17,8 @@
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<NuGetPackageImportStamp>d37384c8</NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
...@@ -50,17 +49,28 @@ ...@@ -50,17 +49,28 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="mscorlib" /> <Reference Include="mscorlib" />
<Reference Include="System" /> <Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<Reference Include="System.Xml" /> <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
<Reference Include="xunit.abstractions"> <Private>True</Private>
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> </Reference>
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="xunit.assert"> <Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath> <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="xunit.core"> <Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath> <HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AbstractMessageTest.cs" /> <Compile Include="AbstractMessageTest.cs" />
...@@ -144,11 +154,4 @@ ...@@ -144,11 +154,4 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
</Project> </Project>
\ No newline at end of file
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
using Google.ProtocolBuffers.Collections; using Google.ProtocolBuffers.Collections;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using UnitTest.Issues.TestProtos; using UnitTest.Issues.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class ReusableBuilderTest public class ReusableBuilderTest
{ {
//Issue 28: Circular message dependencies result in null defaults for DefaultInstance //Issue 28: Circular message dependencies result in null defaults for DefaultInstance
[Fact] [Test]
public void EnsureStaticCicularReference() public void EnsureStaticCicularReference()
{ {
MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance; MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance;
...@@ -20,24 +20,24 @@ namespace Google.ProtocolBuffers ...@@ -20,24 +20,24 @@ namespace Google.ProtocolBuffers
Assert.NotNull(ba.Value); Assert.NotNull(ba.Value);
} }
[Fact] [Test]
public void TestModifyDefaultInstance() public void TestModifyDefaultInstance()
{ {
//verify that the default instance has correctly been marked as read-only //verify that the default instance has correctly been marked as read-only
Assert.Equal(typeof(PopsicleList<bool>), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType()); Assert.AreEqual(typeof(PopsicleList<bool>), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType());
PopsicleList<bool> list = (PopsicleList<bool>)TestAllTypes.DefaultInstance.RepeatedBoolList; PopsicleList<bool> list = (PopsicleList<bool>)TestAllTypes.DefaultInstance.RepeatedBoolList;
Assert.True(list.IsReadOnly); Assert.IsTrue(list.IsReadOnly);
} }
[Fact] [Test]
public void TestUnmodifiedDefaultInstance() public void TestUnmodifiedDefaultInstance()
{ {
//Simply calling ToBuilder().Build() no longer creates a copy of the message //Simply calling ToBuilder().Build() no longer creates a copy of the message
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void BuildMultipleWithoutChange() public void BuildMultipleWithoutChange()
{ {
//Calling Build() or BuildPartial() does not require a copy of the message //Calling Build() or BuildPartial() does not require a copy of the message
...@@ -46,31 +46,31 @@ namespace Google.ProtocolBuffers ...@@ -46,31 +46,31 @@ namespace Google.ProtocolBuffers
TestAllTypes first = builder.BuildPartial(); TestAllTypes first = builder.BuildPartial();
//Still the same instance? //Still the same instance?
Assert.True(ReferenceEquals(first, builder.Build())); Assert.IsTrue(ReferenceEquals(first, builder.Build()));
//Still the same instance? //Still the same instance?
Assert.True(ReferenceEquals(first, builder.BuildPartial().ToBuilder().Build())); Assert.IsTrue(ReferenceEquals(first, builder.BuildPartial().ToBuilder().Build()));
} }
[Fact] [Test]
public void MergeFromDefaultInstance() public void MergeFromDefaultInstance()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.MergeFrom(TestAllTypes.DefaultInstance); builder.MergeFrom(TestAllTypes.DefaultInstance);
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void BuildNewBuilderIsDefaultInstance() public void BuildNewBuilderIsDefaultInstance()
{ {
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, new TestAllTypes.Builder().Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, new TestAllTypes.Builder().Build()));
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().Build()));
//last test, if you clear a builder it reverts to default instance //last test, if you clear a builder it reverts to default instance
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance,
TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build())); TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build()));
} }
[Fact] [Test]
public void BuildModifyAndRebuild() public void BuildModifyAndRebuild()
{ {
TestAllTypes.Builder b1 = new TestAllTypes.Builder(); TestAllTypes.Builder b1 = new TestAllTypes.Builder();
...@@ -86,80 +86,80 @@ namespace Google.ProtocolBuffers ...@@ -86,80 +86,80 @@ namespace Google.ProtocolBuffers
TestAllTypes m2 = b1.Build(); TestAllTypes m2 = b1.Build();
Assert.Equal("{\"optional_foreign_message\":{},\"repeated_int32\":[2],\"default_int32\":1}", Extensions.ToJson(m1)); Assert.AreEqual("{\"optional_foreign_message\":{},\"repeated_int32\":[2],\"default_int32\":1}", Extensions.ToJson(m1));
Assert.Equal("{\"optional_foreign_message\":{\"c\":7},\"repeated_int32\":[2,6],\"default_int32\":5}", Extensions.ToJson(m2)); Assert.AreEqual("{\"optional_foreign_message\":{\"c\":7},\"repeated_int32\":[2,6],\"default_int32\":5}", Extensions.ToJson(m2));
} }
[Fact] [Test]
public void CloneOnChangePrimitive() public void CloneOnChangePrimitive()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetDefaultBool(true); builder.SetDefaultBool(true);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnAddRepeatedBool() public void CloneOnAddRepeatedBool()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.AddRepeatedBool(true); builder.AddRepeatedBool(true);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnGetRepeatedBoolList() public void CloneOnGetRepeatedBoolList()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedBoolList); GC.KeepAlive(builder.RepeatedBoolList);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnChangeMessage() public void CloneOnChangeMessage()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetOptionalForeignMessage(new ForeignMessage.Builder()); builder.SetOptionalForeignMessage(new ForeignMessage.Builder());
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnClearMessage() public void CloneOnClearMessage()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.ClearOptionalForeignMessage(); builder.ClearOptionalForeignMessage();
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnGetRepeatedForeignMessageList() public void CloneOnGetRepeatedForeignMessageList()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedForeignMessageList); GC.KeepAlive(builder.RepeatedForeignMessageList);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnChangeEnumValue() public void CloneOnChangeEnumValue()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAR); builder.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAR);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
[Fact] [Test]
public void CloneOnGetRepeatedForeignEnumList() public void CloneOnGetRepeatedForeignEnumList()
{ {
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.True(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedForeignEnumList); GC.KeepAlive(builder.RepeatedForeignEnumList);
Assert.False(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
} }
} }
......
using UnitTest.Issues.TestProtos; using UnitTest.Issues.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class TestCornerCases public class TestCornerCases
{ {
[Fact] [Test]
public void TestRoundTripNegativeEnums() public void TestRoundTripNegativeEnums()
{ {
NegativeEnumMessage msg = NegativeEnumMessage.CreateBuilder() NegativeEnumMessage msg = NegativeEnumMessage.CreateBuilder()
...@@ -19,16 +19,16 @@ namespace Google.ProtocolBuffers ...@@ -19,16 +19,16 @@ namespace Google.ProtocolBuffers
.AddPackedValues(NegativeEnum.FiveBelow) //10 .AddPackedValues(NegativeEnum.FiveBelow) //10
.Build(); .Build();
Assert.Equal(58, msg.SerializedSize); Assert.AreEqual(58, msg.SerializedSize);
byte[] bytes = new byte[58]; byte[] bytes = new byte[58];
CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); CodedOutputStream output = CodedOutputStream.CreateInstance(bytes);
msg.WriteTo(output); msg.WriteTo(output);
Assert.Equal(0, output.SpaceLeft); Assert.AreEqual(0, output.SpaceLeft);
NegativeEnumMessage copy = NegativeEnumMessage.ParseFrom(bytes); NegativeEnumMessage copy = NegativeEnumMessage.ParseFrom(bytes);
Assert.Equal(msg, copy); Assert.AreEqual(msg, copy);
} }
} }
} }
...@@ -3,13 +3,13 @@ using System.IO; ...@@ -3,13 +3,13 @@ using System.IO;
using System.Text; using System.Text;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Google.ProtocolBuffers.Serialization.Http; using Google.ProtocolBuffers.Serialization.Http;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class TestReaderForUrlEncoded public class TestReaderForUrlEncoded
{ {
[Fact] [Test]
public void Example_FromQueryString() public void Example_FromQueryString()
{ {
Uri sampleUri = new Uri("http://sample.com/Path/File.ext?text=two+three%20four&valid=true&numbers=1&numbers=2", UriKind.Absolute); Uri sampleUri = new Uri("http://sample.com/Path/File.ext?text=two+three%20four&valid=true&numbers=1&numbers=2", UriKind.Absolute);
...@@ -20,14 +20,14 @@ namespace Google.ProtocolBuffers ...@@ -20,14 +20,14 @@ namespace Google.ProtocolBuffers
builder.MergeFrom(input); builder.MergeFrom(input);
TestXmlMessage message = builder.Build(); TestXmlMessage message = builder.Build();
Assert.Equal(true, message.Valid); Assert.AreEqual(true, message.Valid);
Assert.Equal("two three four", message.Text); Assert.AreEqual("two three four", message.Text);
Assert.Equal(2, message.NumbersCount); Assert.AreEqual(2, message.NumbersCount);
Assert.Equal(1, message.NumbersList[0]); Assert.AreEqual(1, message.NumbersList[0]);
Assert.Equal(2, message.NumbersList[1]); Assert.AreEqual(2, message.NumbersList[1]);
} }
[Fact] [Test]
public void Example_FromFormData() public void Example_FromFormData()
{ {
Stream rawPost = new MemoryStream(Encoding.UTF8.GetBytes("text=two+three%20four&valid=true&numbers=1&numbers=2"), false); Stream rawPost = new MemoryStream(Encoding.UTF8.GetBytes("text=two+three%20four&valid=true&numbers=1&numbers=2"), false);
...@@ -38,42 +38,42 @@ namespace Google.ProtocolBuffers ...@@ -38,42 +38,42 @@ namespace Google.ProtocolBuffers
builder.MergeFrom(input); builder.MergeFrom(input);
TestXmlMessage message = builder.Build(); TestXmlMessage message = builder.Build();
Assert.Equal(true, message.Valid); Assert.AreEqual(true, message.Valid);
Assert.Equal("two three four", message.Text); Assert.AreEqual("two three four", message.Text);
Assert.Equal(2, message.NumbersCount); Assert.AreEqual(2, message.NumbersCount);
Assert.Equal(1, message.NumbersList[0]); Assert.AreEqual(1, message.NumbersList[0]);
Assert.Equal(2, message.NumbersList[1]); Assert.AreEqual(2, message.NumbersList[1]);
} }
[Fact] [Test]
public void TestEmptyValues() public void TestEmptyValues()
{ {
ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text=&numbers=1"); ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text=&numbers=1");
TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder();
builder.MergeFrom(input); builder.MergeFrom(input);
Assert.True(builder.Valid); Assert.IsTrue(builder.Valid);
Assert.True(builder.HasText); Assert.IsTrue(builder.HasText);
Assert.Equal("", builder.Text); Assert.AreEqual("", builder.Text);
Assert.Equal(1, builder.NumbersCount); Assert.AreEqual(1, builder.NumbersCount);
Assert.Equal(1, builder.NumbersList[0]); Assert.AreEqual(1, builder.NumbersList[0]);
} }
[Fact] [Test]
public void TestNoValue() public void TestNoValue()
{ {
ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text&numbers=1"); ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text&numbers=1");
TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder();
builder.MergeFrom(input); builder.MergeFrom(input);
Assert.True(builder.Valid); Assert.IsTrue(builder.Valid);
Assert.True(builder.HasText); Assert.IsTrue(builder.HasText);
Assert.Equal("", builder.Text); Assert.AreEqual("", builder.Text);
Assert.Equal(1, builder.NumbersCount); Assert.AreEqual(1, builder.NumbersCount);
Assert.Equal(1, builder.NumbersList[0]); Assert.AreEqual(1, builder.NumbersList[0]);
} }
[Fact] [Test]
public void FormUrlEncodedReaderDoesNotSupportChildren() public void FormUrlEncodedReaderDoesNotSupportChildren()
{ {
ICodedInputStream input = FormUrlEncodedReader.CreateInstance("child=uh0"); ICodedInputStream input = FormUrlEncodedReader.CreateInstance("child=uh0");
......
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="xunit" version="2.0.0" targetFramework="net45" /> <package id="NUnit" version="2.6.4" targetFramework="net45" userInstalled="true" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" /> <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" userInstalled="true" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
</packages> </packages>
\ No newline at end of file
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
using System; using System;
using System.IO; using System.IO;
using Google.ProtocolBuffers.TestProtos; using Google.ProtocolBuffers.TestProtos;
using Xunit; using NUnit.Framework;
namespace Google.ProtocolBuffers namespace Google.ProtocolBuffers
{ {
public class AbstractMessageLiteTest public class AbstractMessageLiteTest
{ {
[Fact] [Test]
public void TestMessageLiteToByteString() public void TestMessageLiteToByteString()
{ {
TestRequiredLite msg = TestRequiredLite.CreateBuilder() TestRequiredLite msg = TestRequiredLite.CreateBuilder()
...@@ -52,14 +52,14 @@ namespace Google.ProtocolBuffers ...@@ -52,14 +52,14 @@ namespace Google.ProtocolBuffers
.Build(); .Build();
ByteString b = msg.ToByteString(); ByteString b = msg.ToByteString();
Assert.Equal(4, b.Length); Assert.AreEqual(4, b.Length);
Assert.Equal(TestRequiredLite.DFieldNumber << 3, b[0]); Assert.AreEqual(TestRequiredLite.DFieldNumber << 3, b[0]);
Assert.Equal(42, b[1]); Assert.AreEqual(42, b[1]);
Assert.Equal(TestRequiredLite.EnFieldNumber << 3, b[2]); Assert.AreEqual(TestRequiredLite.EnFieldNumber << 3, b[2]);
Assert.Equal((int) ExtraEnum.EXLITE_BAZ, b[3]); Assert.AreEqual((int) ExtraEnum.EXLITE_BAZ, b[3]);
} }
[Fact] [Test]
public void TestMessageLiteToByteArray() public void TestMessageLiteToByteArray()
{ {
TestRequiredLite msg = TestRequiredLite.CreateBuilder() TestRequiredLite msg = TestRequiredLite.CreateBuilder()
...@@ -69,10 +69,10 @@ namespace Google.ProtocolBuffers ...@@ -69,10 +69,10 @@ namespace Google.ProtocolBuffers
ByteString b = msg.ToByteString(); ByteString b = msg.ToByteString();
ByteString copy = ByteString.CopyFrom(msg.ToByteArray()); ByteString copy = ByteString.CopyFrom(msg.ToByteArray());
Assert.Equal(b, copy); Assert.AreEqual(b, copy);
} }
[Fact] [Test]
public void TestMessageLiteWriteTo() public void TestMessageLiteWriteTo()
{ {
TestRequiredLite msg = TestRequiredLite.CreateBuilder() TestRequiredLite msg = TestRequiredLite.CreateBuilder()
...@@ -82,10 +82,10 @@ namespace Google.ProtocolBuffers ...@@ -82,10 +82,10 @@ namespace Google.ProtocolBuffers
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
msg.WriteTo(ms); msg.WriteTo(ms);
Assert.Equal(msg.ToByteArray(), ms.ToArray()); Assert.AreEqual(msg.ToByteArray(), ms.ToArray());
} }
[Fact] [Test]
public void TestMessageLiteWriteDelimitedTo() public void TestMessageLiteWriteDelimitedTo()
{ {
TestRequiredLite msg = TestRequiredLite.CreateBuilder() TestRequiredLite msg = TestRequiredLite.CreateBuilder()
...@@ -97,21 +97,21 @@ namespace Google.ProtocolBuffers ...@@ -97,21 +97,21 @@ namespace Google.ProtocolBuffers
msg.WriteDelimitedTo(ms); msg.WriteDelimitedTo(ms);
byte[] buffer = ms.ToArray(); byte[] buffer = ms.ToArray();
Assert.Equal(5, buffer.Length); Assert.AreEqual(5, buffer.Length);
Assert.Equal(4, buffer[0]); Assert.AreEqual(4, buffer[0]);
byte[] msgBytes = new byte[4]; byte[] msgBytes = new byte[4];
Array.Copy(buffer, 1, msgBytes, 0, 4); Array.Copy(buffer, 1, msgBytes, 0, 4);
Assert.Equal(msg.ToByteArray(), msgBytes); Assert.AreEqual(msg.ToByteArray(), msgBytes);
} }
[Fact] [Test]
public void TestIMessageLiteWeakCreateBuilderForType() public void TestIMessageLiteWeakCreateBuilderForType()
{ {
IMessageLite msg = TestRequiredLite.DefaultInstance; IMessageLite msg = TestRequiredLite.DefaultInstance;
Assert.Equal(typeof(TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType()); Assert.AreEqual(typeof(TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType());
} }
[Fact] [Test]
public void TestMessageLiteWeakToBuilder() public void TestMessageLiteWeakToBuilder()
{ {
IMessageLite msg = TestRequiredLite.CreateBuilder() IMessageLite msg = TestRequiredLite.CreateBuilder()
...@@ -120,14 +120,14 @@ namespace Google.ProtocolBuffers ...@@ -120,14 +120,14 @@ namespace Google.ProtocolBuffers
.Build(); .Build();
IMessageLite copy = msg.WeakToBuilder().WeakBuild(); IMessageLite copy = msg.WeakToBuilder().WeakBuild();
Assert.Equal(msg.ToByteArray(), copy.ToByteArray()); Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
} }
[Fact] [Test]
public void TestMessageLiteWeakDefaultInstanceForType() public void TestMessageLiteWeakDefaultInstanceForType()
{ {
IMessageLite msg = TestRequiredLite.DefaultInstance; IMessageLite msg = TestRequiredLite.DefaultInstance;
Assert.True(Object.ReferenceEquals(TestRequiredLite.DefaultInstance, msg.WeakDefaultInstanceForType)); Assert.IsTrue(Object.ReferenceEquals(TestRequiredLite.DefaultInstance, msg.WeakDefaultInstanceForType));
} }
} }
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="xunit" version="2.0.0" targetFramework="net45" /> <package id="NUnit" version="2.6.4" targetFramework="net45" userInstalled="true" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" /> <package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" userInstalled="true" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
</packages> </packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment