private void CreateSimpleReference()
 {            
     simple = new MockReferenceObject();
     MockReferenceObject m2 = new MockReferenceObject();
     simple.Name = "m1";
     m2.Name = "m2";
     simple.Reference = m2;
     m2.Reference = simple;
 }
        private void CreateDeepReference()
        {
            deep = new MockReferenceObject();
            MockReferenceObject m2 = new MockReferenceObject();
            MockReferenceObject m3 = new MockReferenceObject();
            MockReferenceObject m4 = new MockReferenceObject();

            deep.Name = "m1";
            m2.Name = "m2";
            m3.Name = "m3";
            m4.Name = "m4";
            deep.Reference = m2;
            m2.Reference = m3;
            m3.Reference = m4;
            m4.Reference = m2;

        }
 public void TestCollectionIndexReference()
 {
     MockReferenceObject[] mockArray = new MockReferenceObject[] { simple };
     Serializer s = new Serializer(typeof(MockReferenceObject));
     s.Config.ReferenceWritingType = SerializationContext.ReferenceOption.WriteIdentifier;
     string result = s.Serialize(mockArray);
     MockReferenceObject[] actual = (MockReferenceObject[]) s.Deserialize(result);
     Assert.AreSame(actual[0], actual[0].Reference.Reference, "reference inside collection not equal");
 }