Пример #1
0
        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();
        }
Пример #4
0
        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>();
        }
Пример #5
0
        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();
        }
Пример #6
0
 public void Initialize()
 {
     _context                = new InMemoryDispatchingDbContext(_fixture.Create <string>());
     _domainModelMapper      = Substitute.For <IMapToPersistenceModel <Cab, PersistenceModel.Cab> >();
     _persistenceModelMapper = Substitute.For <IMapToDomainModel <PersistenceModel.Cab, Cab> >();
 }
Пример #7
0
 protected abstract void Apply(DispatchingDbContext dispatchingDbContext);
Пример #8
0
 internal DispatchingDbContextBuilder(string dbName)
 {
     _dbContext = new InMemoryDispatchingDbContext(dbName);
 }
Пример #9
0
 protected override void Apply(DispatchingDbContext dispatchingDbContext)
 {
 }