public async Task ModifyStudentDetailsTest() { var obj = new EditStudentInfoCommand { StudentId = 1, LastName = "Test User" }; var res = await _editStudentInfoCommandHandler.Handle(obj) as Results; Assert.AreEqual(true, res.IsSuccessful); }
public async Task TestEditStudentInfoCommandPassingInvalidStudentId() { var obj = new EditStudentInfoCommand { StudentId = 235, LastName = "Invalid student" }; var res = await _editStudentInfoCommandHandler.Handle(obj) as Results; Assert.AreEqual(false, res.IsSuccessful); StringAssert.Contains(res.ResponseMessage, "Student not found"); Assert.AreEqual(State.notFound, res.Status); }
public async Task TestValidationOfCommandObject() { var obj = new EditStudentInfoCommand { StudentId = 1, 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 " }; var res = await _editStudentInfoCommandHandler.Handle(obj) as Results; Assert.AreEqual(false, res.IsSuccessful); StringAssert.EndsWith(res.ResponseMessage, "50."); Assert.AreEqual(State.unProcessableEntity, res.Status); }