コード例 #1
0
        public void TestIndex_WhenNoError_ReturnIndexView()
        {
            // Arrange
            IUnitOfWork unitOfWork = new UnitOfWork();
            UserController target = new UserController(unitOfWork);
            Nullable<bool> errorOccurred = null;

            // Act
            ViewResult actual = target.Index(errorOccurred);

            // Assert
            Assert.AreEqual("Index", actual.ViewName);
            Assert.AreEqual(null, actual.ViewBag.ErrorMessage);

            //TODO: check number of records returned by model
        }
コード例 #2
0
        public void TestIndex_WhenError_ReturnIndexViewAndErrorMessage()
        {
            // Arrange
            IUnitOfWork unitOfWork = new UnitOfWork();
            UserController target = new UserController(unitOfWork);
            Nullable<bool> errorOccurred = true;

            // Act
            ViewResult actual = target.Index(errorOccurred);

            // Assert
            Assert.AreEqual("Index", actual.ViewName);
            Assert.AreEqual("Error occurred.", actual.ViewBag.ErrorMessage);
        }