public void SerializeUnique() { UniqueStuff d = new UniqueStuff(), result = new UniqueStuff(); d.objects = new InterfaceTests.Unique[] { new InterfaceTests.Unique("1"), new InterfaceTests.Unique("2"), new InterfaceTests.Unique("3"), new InterfaceTests.Unique("4"), new InterfaceTests.Unique("5"), new InterfaceTests.Unique("6"), new InterfaceTests.Unique("cool"), new InterfaceTests.Unique("elvis"), new InterfaceTests.Unique("hello"), new InterfaceTests.Unique("foo"), new InterfaceTests.Unique("world"), new InterfaceTests.Unique("elvis"), new InterfaceTests.Unique(null), null, new InterfaceTests.Unique("7"), new InterfaceTests.Unique("8"), new InterfaceTests.Unique("9"), new InterfaceTests.Unique("10"), new InterfaceTests.Unique("11"), new InterfaceTests.Unique("12") }; d.set = new Set <InterfaceTests.Unique>(); d.set.Add(d.objects[9]); d.set.Add(d.objects[10]); d.set.Add(d.objects[8]); d.set.Add(d.objects[11]); d.set.Add(d.objects[7]); d.set.Add(d.objects[12]); d.set.Add(d.objects[6]); d.set.Add(d.objects[13]); d.set.AddMany(new InterfaceTests.Unique[] { d.objects[0], d.objects[1], d.objects[2], d.objects[3], d.objects[4], d.objects[5] }); d.set.AddMany(new InterfaceTests.Unique[] { d.objects[14], d.objects[15], d.objects[16], d.objects[17], d.objects[18], d.objects[19] }); result = (UniqueStuff)InterfaceTests.SerializeRoundTrip(d); InterfaceTests.TestReadWriteCollectionGeneric(result.set, result.objects, false); for (int i = 0; i < result.objects.Length; ++i) { if (result.objects[i] != null) { Assert.IsFalse(object.Equals(result.objects[i], d.objects[i])); } } }
public void SerializeUnique() { var d = new UniqueStuff(); var u1 = new InterfaceTests.Unique("cool"); var u2 = new InterfaceTests.Unique("elvis"); d.objects = new InterfaceTests.Unique[] { new InterfaceTests.Unique("1"), new InterfaceTests.Unique("2"), new InterfaceTests.Unique("3"), new InterfaceTests.Unique("4"), new InterfaceTests.Unique("5"), new InterfaceTests.Unique("6"), u1, u2, new InterfaceTests.Unique("hello"), new InterfaceTests.Unique("foo"), new InterfaceTests.Unique("world"), u2, new InterfaceTests.Unique(null), null, new InterfaceTests.Unique("7"), new InterfaceTests.Unique("8"), new InterfaceTests.Unique("9"), u1, u2, new InterfaceTests.Unique("3") }; d.bag = new Bag <InterfaceTests.Unique> { d.objects[9], d.objects[10], d.objects[8], d.objects[11], d.objects[7], d.objects[12], d.objects[6], d.objects[13] }; d.bag.AddMany(new InterfaceTests.Unique[] { d.objects[0], d.objects[1], d.objects[2], d.objects[3], d.objects[4], d.objects[5] }); d.bag.AddMany(new InterfaceTests.Unique[] { d.objects[14], d.objects[15], d.objects[16], d.objects[17], d.objects[18], d.objects[19] }); UniqueStuff result = (UniqueStuff)InterfaceTests.SerializeRoundTrip(d); InterfaceTests.TestReadWriteCollectionGeneric(result.bag, result.objects, false); for (var i = 0; i < result.objects.Length; ++i) { if (result.objects[i] != null) { Assert.IsFalse(Equals(result.objects[i], d.objects[i])); } } }