public void Validate_To_Test() { _fakeMailRequest = A.Fake <MailRequest>(options => options.ConfigureFake(request => request.From = "*****@*****.**")); _fakeMailRequestValidator = A.Fake <MailRequestValidator>(options => options.WithArgumentsForConstructor(new object[] { _fakeMailRequest } )); Should.Throw <MailRequestValidationException>(() => _fakeMailRequestValidator.Validate()).Message.ShouldBe("MailRequest (To) must be fill"); }
public void Validate_From_Test() { _fakeMailRequest = A.Fake <MailRequest>(options => options.ConfigureFake(request => { request.Body = "Merhaba Dünya"; request.To.Add(new MailAddress("*****@*****.**")); } )); _fakeMailRequestValidator = A.Fake <MailRequestValidator>(options => options.WithArgumentsForConstructor(new object[] { _fakeMailRequest } )); Should.Throw <MailRequestValidationException>(() => _fakeMailRequestValidator.Validate()).Message.ShouldBe("MailRequest (From) must be fill"); }
public void Validate_Null_Test() { _fakeMailRequestValidator = A.Fake <MailRequestValidator>(options => options.WithArgumentsForConstructor(new object[] { null } )); Should.Throw <MailRequestValidationException>(() => _fakeMailRequestValidator.Validate()).Message.ShouldBe("MailRequest is null"); }