public void ResultData_Update_Default_Should_Pass()
        {
            // Arrange
            var myController = new ResultDataController();

            // Act
            var result = myController.Update("abc");

            // Assert
            Assert.IsNotNull(result);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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);
        }