public async Task RequiredFieldTesting() { var obj = new RegisterStudentInfoCommand { FirstName = string.Empty, LastName = "Student", DOB = DateTime.Parse("1985-11-30"), Email = string.Empty }; var resp = await _registerStudentInfoCommandHandler.Handle(obj); Assert.AreEqual(false, resp.IsSuccessful); Assert.AreEqual(State.unProcessableEntity, resp.Status); }
public async Task InvalidEmailTesting() { var obj = new RegisterStudentInfoCommand { FirstName = "Test", LastName = "Student", DOB = DateTime.Parse("1985-11-30"), Email = "TestStudentsdfsd" }; var resp = await _registerStudentInfoCommandHandler.Handle(obj); Assert.AreEqual(false, resp.IsSuccessful); Assert.AreEqual(State.unProcessableEntity, resp.Status); }
public async Task RegisterStudentTesting() { var obj = new RegisterStudentInfoCommand { FirstName = "Test", LastName = "Student", DOB = DateTime.Parse("1985-11-30"), Email = "*****@*****.**" }; var resp = await _registerStudentInfoCommandHandler.Handle(obj); Assert.AreEqual(true, resp.IsSuccessful); Assert.IsInstanceOfType(resp.ResponseMessage, typeof(Student)); }
public async Task RegisterStudentWithInvalidDOBTesting() { var obj = new RegisterStudentInfoCommand { FirstName = "Test", LastName = "Student", DOB = DateTime.MinValue, Email = "*****@*****.**" }; var resp = await _registerStudentInfoCommandHandler.Handle(obj); Assert.AreEqual(false, resp.IsSuccessful); Assert.AreEqual(State.unProcessableEntity, resp.Status); }
public async Task MaxLengthofstringTesting() { var obj = new RegisterStudentInfoCommand { FirstName = "Test", LastName = "this is lot of text to make bad request this is lot of text to make bad request " + "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " + "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " + "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " + "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request " + "this is lot of text to make bad request this is lot of text to make bad request this is lot of text to make bad request ", DOB = DateTime.Parse("1985-11-30"), Email = "*****@*****.**" }; var resp = await _registerStudentInfoCommandHandler.Handle(obj); Assert.AreEqual(false, resp.IsSuccessful); Assert.AreEqual(State.unProcessableEntity, resp.Status); StringAssert.EndsWith(resp.ResponseMessage, "50."); }