Ejemplo n.º 1
0
        public async Task Add_WhenAddVehicle_ShouldSaveTheVehicle()
        {
            var vehicle = new VehicleDto
            {
                Description = "VW Golf",
                PricePerDay = 10
            };

            var vehicleDto = await _sut.AddNewVehicle(vehicle);

            vehicleDto.Should().NotBeNull();
            vehicleDto.Id.Should().Be(1);
            vehicleDto.Description.Should().Be("VW Golf");
            vehicleDto.PricePerDay.Should().Be(10);

            _dbContext.Vehicles.Count().Should().Be(1);
            var vehicleAdded = await _dbContext.Vehicles.FirstOrDefaultAsync();

            vehicleAdded.Id.Should().Be(1);
            vehicleAdded.Description.Should().Be("VW Golf");
            vehicleAdded.PricePerDay.Should().Be(10);
        }