hi guys
I am new to fluent assertions and really struggling here.
Why is this test failing. Please help. I cant seem to figure out why its failing here, when I run in debug mode, I get
NUnit.Framework.AssertionException
HResult=0x80131500
Message=Expected res.Errors {empty} to contain “Email must be a valid email address”.
and
NUnit.Framework.AssertionException: ‘Expected res.PassedValidation to be true, but found False.’
[TestCase(“user@”)]
[TestCase(“@”)]
[TestCase(“user”)]
[TestCase(null)]
[TestCase(“”)]
public void ValidateRequest_InvalidEmail(string email)
{
//arrange
var request = GetValidRequest();
request.Email = email;
//act
var res = _addNewUserAccountRequestValidator.ValidateRequest(request);
//assert
res.PassedValidation.Should().BeTrue();
res.Errors.Should().Contain("Invalid Email");
}
private AddAccountRequest GetValidRequest()
{
var dept = _fixture.Create();
_context.Dept.Add(dept);
_context.SaveChanges();
var request = _fixture.Build<AddAccountRequest>()
.With(x => x.DeptId, dept.Id)
.With(x => x.Email, "user@domain.com")
.Create();
return request;
}