public void When_an_object_is_not_data_contract_serializable_it_should_fail() { // Arrange var subject = new NonDataContractSerializableClass(); // Act Action act = () => subject.Should().BeDataContractSerializable("we need to store it on {0}", "disk"); // Assert act .Should().Throw <XunitException>() .WithMessage("*we need to store it on disk*EnumMemberAttribute*"); }
public void When_an_object_is_not_data_contract_serializable_it_should_fail() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- var subject = new NonDataContractSerializableClass(); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- Action act = () => subject.Should().BeDataContractSerializable("we need to store it on {0}", "disk"); //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- act .ShouldThrow<AssertFailedException>() .Where(ex => ex.Message.Contains("Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute")); }