public async Task TestCreateWithExistingApartment() { ACMDbContext context = ACMDbContextInMemoryFactory.InitializeContext(); ApartmentService apartmentService = new ApartmentService(context); await apartmentService.Create(1); await Assert.ThrowsAsync <ACMException>(() => apartmentService.Create(1)); }
public async Task TestCreateIfTheIDIOk() { ACMDbContext context = ACMDbContextInMemoryFactory.InitializeContext(); ApartmentService apartmentService = new ApartmentService(context); string id = await apartmentService.Create(1); Assert.Equal(1, context.Apartments.Where(x => x.Id == id).FirstOrDefault().Number); }
public async Task TestCreateWithGoodData() { ACMDbContext context = ACMDbContextInMemoryFactory.InitializeContext(); ApartmentService apartmentService = new ApartmentService(context); await apartmentService.Create(1); Assert.Equal(1, context.Apartments.Count()); }