public void CanSerializeObjectsWithNonPublicConstructor() { var actual = ClassWithPrivCtor.Create(55); var deserialized = Roundtrip(actual); Assert.Equal(actual.Value, deserialized.Value); }
public void CanSerializeObjectsWithNonPublicConstructorInCollections() { IList <ClassWithPrivCtor> actual = new List <ClassWithPrivCtor> { ClassWithPrivCtor.Create(123), ClassWithPrivCtor.Create(239), ClassWithPrivCtor.Create(345746) }; var deserialized = Roundtrip(actual); Assert.Equal(actual.Count, deserialized.Count); Assert.Equal(actual[0].Value, deserialized[0].Value); Assert.Equal(actual[1].Value, deserialized[1].Value); Assert.Equal(actual[2].Value, deserialized[2].Value); }