Ejemplo n.º 1
0
        public void Test_DeleteTruckDriverConfirmed_Return_DeleteTruckDriverViewName_Correct_When_TruckDriverRepo_Return_false()
        {
            // Arrange
            var truckDriver           = MockTruckDriver();
            var truckDriverRepository = new Mock <ITruckDriverRepository>();

            truckDriverRepository.Setup(e => e.DeleteTruckDriver(truckDriver.TruckDriverId)).Returns(false);
            var controller = new TruckDriverController(truckDriverRepository.Object);

            // Act
            var result           = controller.DeleteTruckDriverConfirmed(truckDriver.TruckDriverId) as ViewResult;
            var redirectViewName = result.ViewName;

            // Assert
            Assert.AreEqual(redirectViewName, "DeleteTruckDriver");
        }
Ejemplo n.º 2
0
        public void Test_DeleteTruckDriverConfirmed_Return_ListAllTruckDriversViewName_Correct_When_TruckDriverRepo_Return_true()
        {
            // Arrange
            var truckDriver           = MockTruckDriver();
            var truckDriverRepository = new Mock <ITruckDriverRepository>();

            truckDriverRepository.Setup(e => e.DeleteTruckDriver(truckDriver.TruckDriverId)).Returns(true);
            var controller = new TruckDriverController(truckDriverRepository.Object);

            // Act
            var result           = controller.DeleteTruckDriverConfirmed(truckDriver.TruckDriverId) as RedirectToRouteResult;
            var redirectViewName = result.RouteValues["Action"];

            // Assert
            Assert.AreEqual(redirectViewName, "ListAllTruckDrivers");
        }