public async Task GeneratesId() { var context = DbContextFactory.CreateInMemory(); var handler = new CreateCarCommandHandler(context, mapper); var result = await handler.Handle(generator.CreateCommand, default); Assert.NotEqual(Guid.Empty, result.Id); }
public async Task AddDistinctCar_Works() { var repo = new CarsRepository(_db); var createCommand = new CreateCarCommand { BrandId = 1, ChassisTypeId = 1, ModelName = "new model", SeatsCount = 4, Url = "http://test.ru", UrlImage = "base64:" }; var _logger = new Mock <ILogger <CarsController> >(); var handler = new CreateCarCommandHandler(repo); var cltToken = new System.Threading.CancellationToken(); var result = await handler.Handle(createCommand, cltToken); Assert.True(result != default(Guid)); Assert.Equal(2, _db.Cars.Count()); // Assert.Equal(1, _db.CarImages.Count()); }