Пример #1
0
        public void RegistrationFormTest()
        {
            //Arrange
            var bookingServiceFacadeMock     = new Mock <IBookingServiceFacade>();
            IList <LocationDTO> locationDtos = new List <LocationDTO>
            {
                new LocationDTO("unLogcode1", "name1"),
                new LocationDTO("unLogcode2", "name2")
            };

            bookingServiceFacadeMock.Setup(b => b.ListShippingLocations()).Returns(locationDtos);
            IBookingServiceFacade bookingServiceFacade = bookingServiceFacadeMock.Object;
            var controller = new CargoAdminController(bookingServiceFacade);

            //Act
            var viewModel = controller.RegistrationForm()
                            .GetModel <RegistrationFormViewModel>();

            //Assert
            bookingServiceFacadeMock.Verify(b => b.ListShippingLocations(), Times.Once(),
                                            "ListShippingLocations is not invoked");
            Assert.AreEqual(viewModel.LocationDtos.Count, locationDtos.Count, "Count of Locations is not the same");
            Assert.AreEqual(viewModel.LocationDtos[0].Name, locationDtos[0].Name, "Location Name doesnt match");
            Assert.AreEqual(viewModel.LocationDtos[0].UnLocode, locationDtos[0].UnLocode, "UnLocode doesnt match");
            Assert.AreEqual(viewModel.UnLoccodes[0], locationDtos[0].UnLocode, "UnLoccodes: UnLocode doesnt match");
        }
Пример #2
0
 public CargoAdminController(IBookingServiceFacade bookingServiceFacade)
 {
     BookingServiceFacade = bookingServiceFacade;
 }
Пример #3
0
 public CargoAdminController(IBookingServiceFacade bookingServiceFacade)
 {
     BookingServiceFacade = bookingServiceFacade;
 }