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(); }
public void WhenContextNull_ShouldThrowArgumentNullException() { // Arrange DispatchingDbContext context = null; // Act Action act = () => new LocationRepository(context, _persistenceModelMapper); // Assert act.Should().Throw <ArgumentNullException>(); }
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 void Initialize() { _context = new InMemoryDispatchingDbContext(_fixture.Create <string>()); // Bootstrap var serviceProvider = new ServiceCollection() .UseDispatching() .UseDispatchingPersistenceAdapters(_fixture.Create <string>()) .AddTransient((s) => _context) .BuildServiceProvider(); _sut = serviceProvider.GetService <IProvideLocation>(); }
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 void Initialize() { _context = new InMemoryDispatchingDbContext(_fixture.Create <string>()); _domainModelMapper = Substitute.For <IMapToPersistenceModel <Cab, PersistenceModel.Cab> >(); _persistenceModelMapper = Substitute.For <IMapToDomainModel <PersistenceModel.Cab, Cab> >(); }
protected abstract void Apply(DispatchingDbContext dispatchingDbContext);
internal DispatchingDbContextBuilder(string dbName) { _dbContext = new InMemoryDispatchingDbContext(dbName); }
protected override void Apply(DispatchingDbContext dispatchingDbContext) { }