private void BindControlsTotalSeat() { TripController tripController = new TripController(); string seat = tripController.SelectTotalSeat(this.cboBusNumber.SelectedValue.ToString()); this.txtTotalSeat.Text = seat; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { MyDbContext context = new MyDbContext(); TripController tripController = new TripController(); if (double.TryParse(txtCost.Text, out double cost) == true && int.TryParse(txtNumberSeats.Text, out int number) == true && int.TryParse(txtPlaceDepartment.Text, out int departure) == false && int.TryParse(txtPlaceArrival.Text, out int arrival) == false) { double costTrip = double.Parse(txtCost.Text); int numberSeats = int.Parse(txtNumberSeats.Text); Trip trip = new Trip(dateDeparture.SelectedDate, dateArrival.SelectedDate, txtPlaceDepartment.Text, txtPlaceArrival.Text, costTrip, int.Parse(txtNumberSeats.Text), txtNumberTrain.Text, txtType.Text); if (tripController.AddTrip(trip)) { MessageBox.Show("Рейс успешно добавлен."); TripDataGrid.ClearValue(ItemsControl.ItemsSourceProperty); List <Trip> trips = context.Trips.Include(tr => tr.Train).ToList(); TripDataGrid.ItemsSource = trips; } else { MessageBox.Show("Этот рейс уже существует или введенные данные имеют неверный формат."); } } else { MessageBox.Show("Неверный формат данных"); } }
public async void GetByLineId() { var tripServiceMock = new Mock <ITripService> (); var pathServiceMock = new Mock <IPathService> (); string lineID = "Line:1"; string pathID = "Path:1"; string tripDepartureTime = "20:12:10"; var trip = new Trip(lineID, pathID, tripDepartureTime); var tripDTO = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime); var tripsDTO = new List <TripDTO> () { tripDTO }; var line = new LineId(lineID); tripServiceMock.Setup(_ => _.GetTripsByLineID(line)).ReturnsAsync(tripsDTO); var controller = new TripController(tripServiceMock.Object, pathServiceMock.Object); var actual = await controller.GetByLineId(lineID); Assert.Equal(tripsDTO, actual.Value); }
public void ShouldAttachFalseToIssPassangerIntTrip_ToTheVModel_AndRender_JoinTripBtn_WhenTheServiceReturnsFalse() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); string loggedUserId = "LoggedusrId"; int tripId = 1; controller.GetLoggedUserId = () => loggedUserId; bool isSuccessfullyJoined = false; mockedTripService.Setup(x => x.RequestToJoinTrip(tripId, loggedUserId)) .Returns(isSuccessfullyJoined); // Act and Assert controller.WithCallTo(x => x.RequestToJoinTheTrip(tripId)) .ShouldRenderPartialView("_JoinTripBtn") .WithModel <JoinTripBtnViewModel>(x => x.TripId == tripId && x.IsUserPassangerInTheTrip == isSuccessfullyJoined); }
public void Create_should_return_view() { TripController controller = new TripController(repository, provider); ViewResult result = controller.Create() as ViewResult; Assert.IsNotNull(result); }
public async void Create() { var tripServiceMock = new Mock <ITripService> (); var pathServiceMock = new Mock <IPathService> (); string lineID = "Line:1"; string pathID = "Path:1"; string tripDepartureTime = "20:12:10"; var trip = new Trip(lineID, pathID, tripDepartureTime); var tripDTO = new TripDTO(trip.Id.AsGuid(), new LineId(lineID), new PathId(pathID), tripDepartureTime); var path = new PathId(pathID); var pathDTO = new PathDTO(pathID, true, new List <SegmentDTO> ()); var creatingTrip = new CreatingTripDTO(lineID, pathID, tripDepartureTime); pathServiceMock.Setup(_ => _.GetById(path)).ReturnsAsync(pathDTO); tripServiceMock.Setup(_ => _.AddTrip(creatingTrip, new List <CreatingNodePassageDTO> ())).ReturnsAsync(tripDTO); var controller = new TripController(tripServiceMock.Object, pathServiceMock.Object); var actual = await controller.Create(creatingTrip); Assert.NotNull(actual); Assert.NotNull(actual.Result); }
public void SetModelStateToErrorWithCorrectMessageWhenTripNameAlreadyExistsInComingTrips() { //Arrange var tripMock = new Mock <Trip>().Object; this.tripsServiceMock.Setup(s => s.GetTripByName(It.IsAny <string>())) .Returns(tripMock); var controller = new TripController( this.usersServiceMock.Object, this.tripsServiceMock.Object, this.cacheServiceMock.Object, this.mapperMock.Object); var viewModelMock = new Mock <CreateTripViewModel>().Object; var expected = ErrorMessageConstants.TripNameAlreadyExists; //Act controller.Create(viewModelMock); //Assert var errorMessage = controller.ModelState["TripName"].Errors[0].ErrorMessage; Assert.AreEqual(expected, errorMessage); }
public async Task TripController_GetTripDetails_ShouldReturnMatchingTrip() { // Arrange var tripReference = StringHelper.RandomString(8); _mockTripRepository .Setup(m => m.GetByTripReferenceAsync(It.IsAny <string>())) .ReturnsAsync(TestDataHelper.GetTripCollection(tripReference).FirstOrDefault()) .Verifiable(); // Act var tripController = new TripController(_mockTripRepository.Object, _mockVehicleRepository.Object, _mockBookingRepository.Object, _mockLogger.Object); var result = await tripController.GetTripDetails(tripReference); var objResult = result as OkObjectResult; // Assert Assert.IsNotNull(objResult); var tripResponse = objResult.Value as TripResponseModel; Assert.IsNotNull(tripResponse); Assert.AreEqual(1, tripResponse.Trips.Count()); Assert.AreEqual(tripReference, tripResponse.Trips.FirstOrDefault().TripReference); Assert.AreEqual(TripStatus.Scheduled, tripResponse.Trips.FirstOrDefault().TripStatus.ToEnum <TripStatus>()); _mockTripRepository.Verify(m => m.GetByTripReferenceAsync(It.IsAny <string>()), Times.AtLeastOnce); }
public void CallCaceServiceRemoveMethodOnce() { //Arrange var cacheServiceMock = new Mock <ICacheService>(); tripsServiceMock.Setup(s => s.GetTripByName(It.IsAny <string>())) .Returns((Trip)null); var controller = new TripController( this.usersServiceMock.Object, this.tripsServiceMock.Object, cacheServiceMock.Object, this.mapperMock.Object); var viewModelMock = new Mock <CreateTripViewModel>().Object; viewModelMock.LocalTimeOffsetMinutes = 100; viewModelMock.TripDate = new DateTime(2020, 10, 10, 10, 10, 10); var tripMock = new Mock <Trip>().Object; mapperMock.Setup(m => m.Map <Trip>(viewModelMock)).Returns(tripMock); var fullTripViewModelMock = new Mock <FullTripViewModel>(); mapperMock.Setup(m => m.Map <FullTripViewModel>(It.IsAny <Trip>())).Returns(fullTripViewModelMock.Object); //Act controller.Create(viewModelMock); //Assert cacheServiceMock.Verify(c => c.Remove(It.IsAny <string>()), Times.Once); }
public void RedirectToCorrectAction() { //Arrange tripsServiceMock.Setup(s => s.GetTripByName(It.IsAny <string>())) .Returns((Trip)null); var controller = new TripController( this.usersServiceMock.Object, this.tripsServiceMock.Object, this.cacheServiceMock.Object, this.mapperMock.Object); var viewModelMock = new Mock <CreateTripViewModel>().Object; viewModelMock.LocalTimeOffsetMinutes = 100; viewModelMock.TripDate = new DateTime(2020, 10, 10, 10, 10, 10); var tripMock = new Mock <Trip>().Object; mapperMock.Setup(m => m.Map <Trip>(viewModelMock)).Returns(tripMock); var fullTripViewModelMock = new Mock <FullTripViewModel>(); mapperMock.Setup(m => m.Map <FullTripViewModel>(It.IsAny <Trip>())).Returns(fullTripViewModelMock.Object); //Act / Assert controller.WithCallTo(c => c.Create(viewModelMock)) .ShouldRedirectTo <string>(c => c.ById); }
public void Retrun_JoinTripBtnPartial_WithCorrectlySetPropertiesToViewModel(bool isPassanger) { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); int tripId = 1; string loggedUserId = "LoggedUsrId"; controller.GetLoggedUserId = () => loggedUserId; mockedTripService.Setup(x => x.IsPassengerInTrip(loggedUserId, tripId)) .Returns(isPassanger); // Act and Assert controller.WithCallToChild(x => x.JoinBtn(tripId)) .ShouldRenderPartialView("_JoinTripBtn") .WithModel <JoinTripBtnViewModel>(x => x.IsUserPassangerInTheTrip == isPassanger && x.TripId == tripId); }
public void PassCorrectTripInfo_ToTripService() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); string loggedUserId = "LoggedusrId"; controller.GetLoggedUserId = () => loggedUserId; var viewModel = new CreateTripViewModel() { HourOfDeparture = "12:14" }; var tripCreationInfo = new TripCreationInfo(); mockedMappingProvider.Setup(x => x.Map <CreateTripViewModel, TripCreationInfo>(viewModel)) .Returns(tripCreationInfo); // Act and Assert controller.WithCallTo(x => x.Create(viewModel)) .ShouldRedirectTo(x => x.Create()); mockedTripService.Verify(x => x.CreateTrip(tripCreationInfo), Times.Once); }
public async Task CanEditTrip() { TestTrekStoriesContext tc = new TestTrekStoriesContext(); var trip = new Trip { TripId = 1, Title = "Test Trip", Country = "Ireland", TripCategory = TripCategory.forest, StartDate = new DateTime(2015, 4, 12), TripOwner = "ABC123", }; tc.Trips.Add(trip); TripController controller = new TripController(tc).WithIncomingValues(new FormCollection { { "Title", "Another Title" }, { "TripId", "1" }, { "Country", "Ireland" } }).WithAuthenticatedUser("ABC123"); // Act var result = await controller.EditPost(1); string newTitle = tc.Trips.Find(1).Title; // Assert Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult)); Assert.AreEqual("Another Title", newTitle); }
public async Task CannotEditSomebodyElseTrip() { TestTrekStoriesContext tc = new TestTrekStoriesContext(); var trip = new Trip { TripId = 1, Title = "Test Trip", Country = "Ireland", TripCategory = TripCategory.forest, StartDate = new DateTime(2015, 4, 12), TripOwner = "ABC123", }; tc.Trips.Add(trip); TripController controller = new TripController(tc).WithIncomingValues(new FormCollection { { "Title", "Another Title" }, { "TripId", "1" }, { "Country", "Ireland" } }).WithAuthenticatedUser("AnotherUser"); // Act var result = await controller.EditPost(1) as ViewResult; // Assert Assert.AreEqual("CustomisedError", result.ViewName); }
public async Task EditTripReturnsCorrectDetails() { TestTrekStoriesContext tc = new TestTrekStoriesContext(); var expectedTrip = new Trip { TripId = 1, Title = "Test Trip", Country = "Ireland", TripCategory = TripCategory.forest, StartDate = new DateTime(2015, 4, 12), TripOwner = "ABC123", TotalWalkingDistance = 45 }; tc.Trips.Add(expectedTrip); TripController controller = new TripController(tc).WithAuthenticatedUser("ABC123"); // act var result = await controller.Edit(1) as ViewResult; var resultData = (Trip)result.ViewData.Model; // assert Assert.AreEqual(expectedTrip.Title, resultData.Title); Assert.AreEqual(expectedTrip.Country, resultData.Country); Assert.AreEqual(expectedTrip.TotalWalkingDistance, resultData.TotalWalkingDistance); }
public async Task CannotCreateTripWithSameTitleForSameUser() { TestTrekStoriesContext tc = new TestTrekStoriesContext(); Trip trip = new Trip { Title = "Test", Country = "Ireland", TripCategory = TripCategory.forest, StartDate = new DateTime(2015, 4, 12), TripOwner = "User1" }; tc.Trips.Add(trip); Trip newTrip = new Trip { Title = "Test", Country = "Spain", TripCategory = TripCategory.coast, StartDate = new DateTime(2015, 4, 12), TripOwner = "User1" }; var controller = new TripController(tc).WithAuthenticatedUser("User1"); var result = await controller.Create(newTrip) as ViewResult; Assert.AreEqual(false, result.ViewData.ModelState.IsValid); Assert.IsTrue(controller.ViewData.ModelState.Count == 1, "You have already created a trip with that title. Please give this trip a different title."); }
public async Task DetailsReturnsCorrectTrip() { TestTrekStoriesContext tc = new TestTrekStoriesContext(); var trip = new Trip { TripId = 1, Title = "Test Trip", Country = "Ireland", TripCategory = TripCategory.forest, StartDate = new DateTime(2015, 4, 12), TripOwner = "ABC123", TotalWalkingDistance = 45 }; tc.Trips.Add(trip); var controller = new TripController(tc).WithAuthenticatedUser("Whatever"); var result = await controller.Details(1) as ViewResult; Trip t = (Trip)((ViewResult)result).Model; Assert.AreEqual("Test Trip", t.Title); Assert.AreEqual(TripCategory.forest, t.TripCategory); Assert.AreEqual(0, t.Duration); Assert.AreEqual(0, t.TotalCost); Assert.AreEqual(45, t.TotalWalkingDistance); }
public void Redirect_ToIndex_WhenTripIs_MarkedAsFinishedSuccesfully() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); int tripId = 1; string loggedUserId = "LoggedUsrId"; controller.GetLoggedUserId = () => loggedUserId; mockedTripService.Setup(x => x.MarkTripAsFinished(tripId, loggedUserId)) .Returns(true); // Act and Assert controller.WithCallTo(x => x.MarkTripAsFinished(tripId)) .ShouldRedirectTo <HomeController>(x => x.Index(0)); }
public void SetModelStateToErrorWithCorrectMessageWhenTripIsSetupInThePast() { //Arrange this.tripsServiceMock.Setup(s => s.GetTripByName(It.IsAny <string>())) .Returns((Trip)null); var controller = new TripController( this.usersServiceMock.Object, this.tripsServiceMock.Object, this.cacheServiceMock.Object, this.mapperMock.Object); var viewModelMock = new Mock <CreateTripViewModel>().Object; viewModelMock.LocalTimeOffsetMinutes = 100; viewModelMock.TripDate = new DateTime(2010, 10, 10, 10, 10, 10); var expected = ErrorMessageConstants.TripDateInThePast; //Act controller.Create(viewModelMock); //Assert var errorMessage = controller.ModelState["TripDate"].Errors[0].ErrorMessage; Assert.AreEqual(expected, errorMessage); }
public void Call_RecentTripsPartial_WithDataFromTripService() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); var latestTripsCount = 6; var tripsBasicInfo = new List <TripBasicInfo>(); mockedTripService.Setup(x => x.GetLatestTripsBasicInfo(latestTripsCount)) .Returns(tripsBasicInfo); var tripsBasicInfoViewModel = new List <TripBasicInfoViewModel>(); mockedMappingProvider.Setup(x => x.Map <IEnumerable <TripBasicInfo>, IEnumerable <TripBasicInfoViewModel> >(tripsBasicInfo)) .Returns(tripsBasicInfoViewModel); // Act and Assert controller.WithCallTo(x => x.RecentTrips()) .ShouldRenderPartialView("_RecentTrips") .WithModel(tripsBasicInfoViewModel); }
public void AttachFalse_ToTheViewModel_WhenUserIsNotInTrip() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); int tripId = 1; string loggedUserId = "LoggedUsrId"; controller.GetLoggedUserId = () => loggedUserId; var isIsuccesfullySignedOut = true; mockedTripService.Setup(x => x.SignOutOfTrip(tripId, loggedUserId)) .Returns(isIsuccesfullySignedOut); bool IsUserInTheTrip = !isIsuccesfullySignedOut; // Act and Assert controller.WithCallTo(x => x.SignOutOftheTrip(tripId)) .ShouldRenderPartialView("_JoinTripBtn") .WithModel <JoinTripBtnViewModel>(x => x.IsUserPassangerInTheTrip == IsUserInTheTrip && x.TripId == tripId); }
public async Task TripController_Reset_WhenTripDoesNotExist_ShouldReturnNotFound() { // Arrange var tripReference = StringHelper.RandomString(8); var bookingReference = StringHelper.RandomString(6); _mockTripRepository .Setup(m => m.GetByTripReferenceAsync(It.IsAny <string>())) .ReturnsAsync(default(Trip)) .Verifiable(); _mockTripRepository .Setup(m => m.ResetAsync(It.IsAny <Trip>())) .Returns(Task.FromResult <object>(null)) .Verifiable(); _mockBookingRepository .Setup(m => m.GetByTripReferenceAsync(It.IsAny <string>())) .ReturnsAsync(default(IEnumerable <Booking>)) .Verifiable(); _mockBookingRepository .Setup(m => m.CancelAsync(It.IsAny <Booking>())) .Returns(Task.FromResult <object>(null)) .Verifiable(); // Act var tripController = new TripController(_mockTripRepository.Object, _mockVehicleRepository.Object, _mockBookingRepository.Object, _mockLogger.Object); var result = await tripController.Reset(tripReference); // Assert Assert.IsNotNull(result as NotFoundObjectResult); _mockTripRepository.Verify(m => m.GetByTripReferenceAsync(It.IsAny <string>()), Times.Once); _mockTripRepository.Verify(m => m.ResetAsync(It.IsAny <Trip>()), Times.Never); _mockBookingRepository.Verify(m => m.GetByTripReferenceAsync(It.IsAny <string>()), Times.Never); _mockBookingRepository.Verify(m => m.CancelAsync(It.IsAny <Booking>()), Times.Never); }
public async Task TripController_Search_WhenTripsFound_ShouldReturnOk() { // Arrange var tripReference = StringHelper.RandomString(8); _mockTripRepository .Setup(m => m.GetByTripDetailsAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(TestDataHelper.GetTripCollection(tripReference)) .Verifiable(); // Act var tripController = new TripController(_mockTripRepository.Object, _mockVehicleRepository.Object, _mockBookingRepository.Object, _mockLogger.Object); var result = await tripController.Search("CityA", "CityB", DateTime.Now.ToString("MM-dd-yyyy")); var objResult = result as OkObjectResult; // Assert Assert.IsNotNull(objResult); var tripResponse = objResult.Value as TripResponseModel; Assert.IsNotNull(tripResponse); Assert.IsTrue(tripResponse.Trips.Count() > 0); Assert.AreEqual(tripReference, tripResponse.Trips.FirstOrDefault().TripReference); Assert.AreEqual(TripStatus.Scheduled, tripResponse.Trips.FirstOrDefault().TripStatus.ToEnum <TripStatus>()); _mockTripRepository.Verify(m => m.GetByTripDetailsAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); }
public void RedirectTo_CreateCarPage_WhenuserCarsAreNull() { // Arrange var mockedTripService = new Mock <ITripService>(); var mockedTagService = new Mock <ITagService>(); var mockedCarService = new Mock <ICarService>(); var mockedMappingProvider = new Mock <IMappingProvider>(); var controller = new TripController( mockedTripService.Object, mockedTagService.Object, mockedCarService.Object, mockedMappingProvider.Object); mockedTagService.Setup(x => x.GetAllTags()) .Returns(new List <TagInfo>()); var userId = "userId"; controller.GetLoggedUserId = () => userId; List <CarBasicInfo> cars = null; mockedCarService.Setup(x => x.GetUserCars(userId)) .Returns(cars); // Act and Assert controller.WithCallTo(x => x.Create()) .ShouldRedirectTo((ManageController c) => c.RegisterCar()); }
public async Task TripController_Reset_WhenBookingExists_ShouldReturnOk() { // Arrange var tripReference = StringHelper.RandomString(8); var bookingReference = StringHelper.RandomString(6); _mockTripRepository .Setup(m => m.GetByTripReferenceAsync(It.IsAny <string>())) .ReturnsAsync(TestDataHelper.GetTripCollection(tripReference).FirstOrDefault()) .Verifiable(); _mockTripRepository .Setup(m => m.ResetAsync(It.IsAny <Trip>())) .Returns(Task.FromResult <object>(null)) .Verifiable(); _mockBookingRepository .Setup(m => m.GetByTripReferenceAsync(It.IsAny <string>())) .ReturnsAsync(TestDataHelper.GetBookingCollection(bookingReference, tripReference)) .Verifiable(); _mockBookingRepository .Setup(m => m.CancelAsync(It.IsAny <Booking>())) .Returns(Task.FromResult <object>(null)) .Verifiable(); // Act var tripController = new TripController(_mockTripRepository.Object, _mockVehicleRepository.Object, _mockBookingRepository.Object, _mockLogger.Object); var result = await tripController.Reset(tripReference); // Assert Assert.IsNotNull(result as OkResult); _mockTripRepository.Verify(m => m.GetByTripReferenceAsync(It.IsAny <string>()), Times.Once); _mockTripRepository.Verify(m => m.ResetAsync(It.IsAny <Trip>()), Times.Once); _mockBookingRepository.Verify(m => m.GetByTripReferenceAsync(It.IsAny <string>()), Times.Once); _mockBookingRepository.Verify(m => m.CancelAsync(It.IsAny <Booking>()), Times.Once); }
public async Task TripController_Add_WhenVehiceDoesNotExist_ShouldReturnNotFound() { // Arrange var tripReference = StringHelper.RandomString(8); var vinReference = StringHelper.RandomString(6); _mockVehicleRepository .Setup(m => m.GetByVinAsync(It.IsAny <string>())) .ReturnsAsync(default(Vehicle)) .Verifiable(); _mockTripRepository .Setup(m => m.AddAsync(It.IsAny <Trip>())) .ReturnsAsync(tripReference) .Verifiable(); // Act var tripController = new TripController(_mockTripRepository.Object, _mockVehicleRepository.Object, _mockBookingRepository.Object, _mockLogger.Object); var result = await tripController.Add(new TripRequestModel { FromCity = "CityA", ToCity = "CityB", DepartureTime = DateTime.Now.AddHours(2), ArrivalTime = DateTime.Now.AddHours(10), VehicleNumber = vinReference }); // Assert Assert.IsNotNull(result as NotFoundObjectResult); _mockVehicleRepository.Verify(m => m.GetByVinAsync(It.IsAny <string>()), Times.Once); _mockTripRepository.Verify(m => m.AddAsync(It.IsAny <Trip>()), Times.Never); }
public _TripsTableModel(ApplicationDbContext db, ETripFilter tripFilter) { _customerController = new CustomerController(db); _tripController = new TripController(db); _carController = new CarController(db); TripFilter = tripFilter; }
public AllTripsModel(ApplicationDbContext db) { _db = db; _customerController = new CustomerController(db); _tripController = new TripController(db); _carController = new CarController(db); }
internal List <Trip> GetTripSummaries(int linkWarehouseId) { return(TripController.GetTripSummaries( linkWarehouseId, Convert.ToDateTime("01/01/1900"), Convert.ToDateTime("10/12/2099"), "")); }
public void Details_returns_correct_Trip_Details() { TripController controller = new TripController(repository, provider); ViewResult result = controller.Details(userTrip.TripID) as ViewResult; Trip model = result.Model as Trip; Assert.AreEqual(model, userTrip); }
public TripControllerTest() { var dataDirectory = ConfigurationManager.AppSettings["DataDirectory"]; var absoluteDataDirectory = Path.GetFullPath(dataDirectory); AppDomain.CurrentDomain.SetData("DataDirectory", absoluteDataDirectory); SetCurrentIdentity(GetInitialAdminUser(), AdminRole); TripController = new TripController(UserHelper.Object); UserController = new UserController(UserHelper.Object); }
public void TestInitialize() { Subject = new TripController(); }