protected override void Apply(DispatchingDbContext dispatchingDbContext) { var distance = _fixture.Create <int>(); var cab = _fixture.Create <Persistence.PersistenceModel.Cab>(); cab.Latitude = _location.Latitude; cab.Longitude = _location.Longitude; dispatchingDbContext.Cabs.Add(cab); dispatchingDbContext.SaveChanges(); }
protected override void Apply(DispatchingDbContext dispatchingDbContext) { var location = _fixture.Create <Persistence.PersistenceModel.Location>(); location.Name = _name; location.Latitude = _location.Latitude; location.Longitude = _location.Longitude; dispatchingDbContext.Locations.Add(location); dispatchingDbContext.SaveChanges(); }
public async Task WhenUtrechtCentraalExists_ShouldMapLocation() { // Arrange var location = _fixture.Create <PersistenceModel.Location>(); location.Name = "Utrecht Centraal"; using (_context) { _context.Locations.Add(location); _context.SaveChanges(); // Act var sut = new LocationRepository(_context, _persistenceModelMapper); await sut.GetTrainStationLocation(); // Assert _persistenceModelMapper .Received(1) .Map(Arg.Is(location)); } }
public async Task WhenTrainstationExistsInDatabase_ShouldReturnLocation() { // Arrange var location = _fixture.Create <PersistenceModel.Location>(); location.Name = "Utrecht Centraal"; _context.Locations.Add(location); _context.SaveChanges(); // Act var actual = await _sut.GetTrainStationLocation(); // Assert actual.Should().NotBeNull(); }
private void AddRecordsToLookupTable(Location from, Location to) { var distance = _fixture.Create <PersistenceModel.Distance>(); distance.FromLatitude = from.Latitude; distance.FromLongitude = from.Longitude; distance.ToLatitude = to.Latitude; distance.ToLongitude = to.Longitude; _context.Distances.Add(distance); var inverse = _fixture.Create <PersistenceModel.Distance>(); inverse.FromLatitude = to.Latitude; inverse.FromLongitude = to.Longitude; inverse.ToLatitude = from.Latitude; inverse.ToLongitude = from.Longitude; _context.Distances.Add(inverse); _context.SaveChanges(); }
protected override void Apply(DispatchingDbContext dispatchingDbContext) { dispatchingDbContext.Distances.Add(new Persistence.PersistenceModel.Distance { ToLongitude = _a.Longitude, ToLatitude = _a.Latitude, FromLatitude = _b.Latitude, FromLongitude = _b.Longitude, Id = _fixture.Create <Guid>(), Kilometers = _distance }); dispatchingDbContext.Distances.Add(new Persistence.PersistenceModel.Distance { ToLongitude = _b.Longitude, ToLatitude = _b.Latitude, FromLatitude = _a.Latitude, FromLongitude = _a.Longitude, Id = _fixture.Create <Guid>(), Kilometers = _distance }); dispatchingDbContext.SaveChanges(); }
public DispatchingDbContext Build() { _dbContext.SaveChanges(); return(_dbContext); }