public void T12_DictComparerComplex() { using (var ms = new MemoryStream()) { var s = new SlimSerializer(); var cmpr = new Comparer1(); var c1 = new C13(); var c2 = new C13(); var dict1 = new Dictionary <int, C13>(cmpr); dict1[1] = c1; dict1[2] = c1; dict1[3] = c2; var dict2 = new Dictionary <int, C13>(cmpr); dict2[1] = c2; dict2[2] = c1; var dIn = new List <S3>(); dIn.Add(new S3() { FDict = dict1 }); dIn.Add(new S3() { FDict = dict1 }); dIn.Add(new S3() { FDict = dict2 }); s.Serialize(ms, dIn); ms.Seek(0, SeekOrigin.Begin); var dOut = (List <S3>)s.Deserialize(ms); Assert.AreSame(dOut[0].FDict, dOut[1].FDict); Assert.AreNotSame(dOut[0].FDict, dOut[2].FDict); Assert.AreSame(dOut[0].FDict[1], dOut[0].FDict[2]); Assert.AreNotSame(dOut[0].FDict[1], dOut[0].FDict[3]); Assert.AreSame(dOut[0].FDict[1], dOut[2].FDict[2]); Assert.AreSame(dOut[0].FDict[3], dOut[2].FDict[1]); } }
public static void TestI7() { var a = new C10(); I7 <int, string, bool> i = a; Assert.AreEqual(1, i.Foo()); var a1 = new C11 <int, string, bool>(); i = a1; Assert.AreEqual(1, i.Foo()); var a2 = new C12 <int, string, bool>(); I7 <I5 <int>, I5 <string>, I5 <bool> > i2 = a2; Assert.AreEqual(1, i2.Foo()); var a3 = new C13 <int, string, bool>(); I7 <I5 <I5 <int> >, I5 <I5 <string> >, I5 <I5 <bool> > > i3 = a3; Assert.AreEqual(1, i3.Foo()); }