public void WhenLatitude_ShouldMapLatitude() { // Arrange var actual = new PersistenceModel.Cab(); // Act _sut.Apply(_itemToMap, actual); // Assert actual.Latitude.Should().Be(_itemToMap.CurrentLocation.Latitude); }
public void WhenId_ShouldMapId() { // Arrange var actual = new PersistenceModel.Cab(); // Act _sut.Apply(_itemToMap, actual); // Assert actual.Id.Should().Be(_itemToMap.Id.ToGuid()); }
public async Task Initialize() { _databaseName = _fixture.Create <string>(); // Arrange _cab = _fixture.Create <Cab>(); _mappedCab = _fixture.Create <PersistenceModel.Cab>(); var persistenceModelMapper = Substitute.For <IMapToDomainModel <PersistenceModel.Cab, Cab> >(); var domainModelMapper = CreateDomainModelMapper(_mappedCab); // Act using (var dbContext = CreateDbContext()) { var sut = new CabRepository(dbContext, domainModelMapper, persistenceModelMapper); await sut.Update(_cab); } }
public DispatchingDbContextBuilder WithCab(Guid cabId, decimal distance) { var cab = new PersistenceModel.Cab { Id = cabId, Latitude = _fixture.Create <decimal>(), Longitude = _fixture.Create <decimal>() }; _dbContext.Cabs.Add(cab); _dbContext.Distances.Add(new PersistenceModel.Distance { Id = _fixture.Create <Guid>(), Kilometers = distance, ToLongitude = _location.Longitude, ToLatitude = _location.Latitude, FromLatitude = cab.Latitude, FromLongitude = cab.Longitude }); return(this); }
private IMapToPersistenceModel <Cab, PersistenceModel.Cab> CreateDomainModelMapper(PersistenceModel.Cab cab) { var mapper = Substitute.For <IMapToPersistenceModel <Cab, PersistenceModel.Cab> >(); mapper .CreateNew() .Returns(cab); return(mapper); }
private DispatchingDbContext CreateDbContext(PersistenceModel.Cab cab) { return(new DispatchingDbContextBuilder(_databaseName) .WithCab(cab) .Build()); }
public DispatchingDbContextBuilder WithCab(PersistenceModel.Cab cab) { _dbContext.Cabs.Add(cab); return(this); }