Exemple #1
0
        public void Test_SearchTruckId_Return_SearchTruckId_View_When_TruckId_Is_Null()
        {
            // Arrange
            var truckLocation           = MockTruckLocationViewModel();
            var truckLocationRepository = new Mock <ITruckLocationRepository>();

            truckLocationRepository.Setup(e => e.SearchTruckLocationByTruckId(truckLocation.TruckId)).Returns(truckLocation);
            var controller = new TruckTrackingController(truckLocationRepository.Object);

            // Act
            var result = controller.SearchTruckId("CM-0004") as ViewResult;

            Assert.AreEqual(result.ViewName, "TruckTracking");
        }
Exemple #2
0
        //SearchTruckId-----------------------------------------------------
        [TestMethod] public void Test_SearchTruckId_Return_SearchTruckId_View_When_TruckId_Is_Exist()
        {
            // Arrange
            var truckLocation           = MockTruckLocationViewModel();
            var truckLocationRepository = new Mock <ITruckLocationRepository>();

            truckLocationRepository.Setup(e => e.SearchTruckLocationByTruckId(truckLocation.TruckId)).Returns(truckLocation);
            var controller = new TruckTrackingController(truckLocationRepository.Object);

            // Act
            var result = controller.SearchTruckId(truckLocation.TruckId) as ViewResult;
            var model  = result.Model;

            // Assert
            Assert.AreEqual(result.ViewName, "SearchTruckId");
            Assert.AreEqual(model, truckLocation);
        }