Пример #1
0
        public async Task AddVehicleModelYearAsync()
        {
            // Arrange
            _context.VehicleMakes.Add(_testModelYear1.Model.Make);
            _context.VehicleModels.Add(_testModelYear1.Model);
            await _context.SaveChangesAsync();

            // Act
            var vehicleModelYear = await _vehicleService.AddVehicleModelYearAsync(_testModelYear1);

            // Assert
            var vehicleModelYearsInDb = await _context.VehicleModelYears.ToListAsync();

            Assert.AreEqual(1, vehicleModelYearsInDb.Count);
            Assert.AreEqual(_testModelYear1.Model.Make.Name, vehicleModelYearsInDb[0].Model.Make.Name);
            Assert.AreEqual(_testModelYear1.Year, vehicleModelYearsInDb[0].Year);
        }