public void AssertType_ShouldThrowExceptionGivenNotExpectedType() { //Arrange ValidationInfo subject = new ValidationInfo("_nameHere", typeof(Example)); //Act Action action = () => subject.Assert(""); //Assert action.Should().Throw <AsserterException>().WithMessage("Expected [name=_nameHere] to be of [type=Example] but found [type=String]"); }
public void AssertType_ShouldThrowExceptionGivenNull() { //Arrange ValidationInfo subject = new ValidationInfo("_nameHere", typeof(string)); //Act Action action = () => subject.Assert(null); //Assert action.Should().Throw <AsserterException>().WithMessage("Expected field [name=_nameHere] to be of [type=String] but a field [name=_nameHere] was not found."); }