public static void Deserializing_constructors___When_properties_do_not_exist___Throws() { // Arrange var expected = new ConstructorWithoutProperties(A.Dummy <string>(), A.Dummy <string>()); // Act var actual1 = Record.Exception(() => expected.RoundtripSerializeViaPropertyBagWithCallbackVerification(null, formats: new[] { SerializationFormat.String })); var actual2 = Record.Exception(() => expected.RoundtripSerializeViaPropertyBagWithCallbackVerification(null, formats: new[] { SerializationFormat.Binary })); // Assert actual1.Message.Should().Be("Could not serialize/deserialize a 'ObcPropertyBagSerializerTest.ConstructorWithoutProperties'; none of its public constructors have parameters where all parameters have a matching property (public, inherited or declared, writable, instance) by name and type."); actual2.Message.Should().Be("Could not serialize/deserialize a 'ObcPropertyBagSerializerTest.ConstructorWithoutProperties'; none of its public constructors have parameters where all parameters have a matching property (public, inherited or declared, writable, instance) by name and type."); }
public static void Deserializing_constructors___When_properties_do_not_exist___Throws() { // Arrange var serializer = new NaosPropertyBagSerializer(); var input = new ConstructorWithoutProperties(A.Dummy <string>(), A.Dummy <string>()); // Act var serializedString = serializer.SerializeToString(input); var exception = Record.Exception(() => serializer.Deserialize <ConstructorWithProperties>(serializedString)); // Act exception.Should().NotBeNull(); exception.Message.Should().Be("Could not find a parameterless constructor or a constructor whose parameter names matched the properties provided; type: Naos.Serialization.Test.NaosPropertyBagSerializerTest+ConstructorWithoutProperties, properties: Property,ToString,GetType."); }