Пример #1
0
        public void HistoryApp_Create_Default_Should_Pass()
        {
            // Arrange
            var myController = new HistoryAppController();

            // Act
            var result = myController.Create();

            // Assert
            Assert.IsNotNull(result);
        }
        public void HistoryApp_Create_Post_Default_Should_Pass()
        {
            // Arrange
            var myController = new HistoryAppController();
            var myData       = new HistoryAppModel();

            // Act
            var result = myController.Create(myData);

            // Reset

            // Assert
            Assert.IsNotNull(result);
        }
        public void HistoryApp_Create_Post_Invalid_Model_Should_Send_Back_For_Edit()
        {
            // Arrange
            var controller = new HistoryAppController();
            var data       = new HistoryAppModel();

            // Make ModelState Invalid
            controller.ModelState.AddModelError("test", "test");

            // Act
            var result = controller.Create(data) as RedirectToActionResult;

            // Assert
            Assert.AreEqual("Error", result.ActionName);
        }