public async Task DeserializesBaseTypeIntoBaseType() { var json = await FileLoader.LoadJson("Complete.json"); var expected = new MessageWithBaseType { Type = "A", Payload = new Payload() }; var value = Serializer.Deserialize <MessageWithBaseType>(json); value.Should().BeEquivalentTo( expected, options => options.RespectingRuntimeTypes()); }
public async Task SerializesOnlyPropertiesOfBaseType() { var request = new MessageWithBaseType { Type = "A", Payload = new PayloadA { Text = "content" } }; var expected = await FileLoader.LoadJson("MissingProperties.json"); var json = Serializer.Serialize(request); json.Should().Be(expected); }
public async Task DeserializesRecognizedTypeIntoGeneric() { var json = await FileLoader.LoadJson("Complete.json"); var expected = new MessageWithBaseType { Type = "A", Payload = new PayloadA { Text = "content" } }; var value = Serializer.Deserialize(json); value.Should().BeEquivalentTo( expected, options => options.RespectingRuntimeTypes()); }