public void ResultData_Update_Default_Should_Pass() { // Arrange var myController = new ResultDataController(); // Act var result = myController.Update("abc"); // Assert Assert.IsNotNull(result); }
public void ResultData_Update_Get_Valid_Data_Should_Pass() { // Arrange var myController = new ResultDataController(); var myData = BiliWeb.Backend.ResultDataBackend.Instance.Index().FirstOrDefault(); // Act var result = myController.Update(myData.ID) as ViewResult; // Assert Assert.IsNotNull(result.Model); }
public void ResultData_Update_Get_InValid_ID_Bogus_Should_Fail() { // Arrange var myController = new ResultDataController(); // Act var result = myController.Update("abc"); // Reset // Assert Assert.IsNotNull(result); }
public void ResultData_Update_Post_Default_Should_Pass() { // Arrange var myController = new ResultDataController(); var myData = new ResultDataModel(); // Act var result = myController.Update(myData); // Reset // Assert Assert.IsNotNull(result); }
public void ResultData_Update_Post_Invalid_Model_Should_Send_Back_For_Edit() { // Arrange var controller = new ResultDataController(); var data = new ResultDataModel(); // Make ModelState Invalid controller.ModelState.AddModelError("test", "test"); // Act var result = controller.Update(data) as NotFoundResult; // Assert Assert.AreEqual(404, result.StatusCode); }
public void ResultData_Update_Post_Valid_Data_Should_Pass() { // Arrange var myController = new ResultDataController(); var myData = BiliWeb.Backend.ResultDataBackend.Instance.Index().FirstOrDefault(); var resultData = new ResultDataModel(myData) { ResultCode = "ResultCode", ID = myData.ID }; // Act var result = myController.Update(resultData) as RedirectToActionResult; //Reset BiliWeb.Backend.DataSourceBackend.Instance.Reset(); // Assert Assert.AreEqual("Index", result.ActionName); }