public async Task WhenItemExists_ShouldReturnItem()
        {
            // Arrange
            var cabRide = _fixture.Create <CabRide>();

            using var dbContext = new DispatchingReadDbContextBuilder(_databaseName)
                                  .WithCabRide(cabRide)
                                  .Build();

            // Act
            var actual = await _sut.FindById(cabRide.Id);

            // Assert
            actual.Id.Should().Be(cabRide.Id);
        }
Beispiel #2
0
        public void Initialize()
        {
            _databaseName = _fixture.Create <string>();

            // Save a cabride in the database
            _cabRide            = _fixture.Create <CabRide>();
            using var dbContext = new DispatchingReadDbContextBuilder(_databaseName)
                                  .WithCabRide(_cabRide)
                                  .Build();

            // Simulate another connection to that database
            _dbContext = new DispatchingReadDbContextBuilder(_databaseName)
                         .Build();

            _cabRide.CustomerId    = _fixture.Create <Guid>();
            _cabRide.TimeOfArrival = _fixture.Create <DateTime>();
            _sut = new CabRideRepository(_dbContext, Substitute.For <IApply <CabRide> >());
        }