public async Task Put() { var queryHandler = new StorageSpaceHandler(BasicNeeds); var sp = context.StorageSpaces.First(); var query = new EditStorageSpace() { Id = sp.Id, Name = "S1", Width = 2, Length = 2, Description = "description", MaintenanceMentions = "mentenanta", ContactData = "contact", TotalVolume = 222, UndevelopedArea = 22, MonthlyMaintenanceCost = 444, AsphaltedArea = 222, AvailableVolume = 334, CountyCode = "B", Street = "Iancului 33", Building = "11", City = "Bucuresti", }; await queryHandler.Handle(query, CancellationToken.None); var cat = await context.StorageSpaces.FirstAsync <StorageSpaceDb>(p => p.Id == sp.Id); Assert.IsTrue(cat.Name == "S1"); }
public async Task Delete() { var handler = new StorageSpaceHandler(BasicNeeds); var sp = context.StorageSpaces.First(); var query = new DeleteStorageSpace { Id = sp.Id, }; await handler.Handle(query, CancellationToken.None); var cat = await context.StorageSpaces.AnyAsync <StorageSpaceDb>(p => p.Id == sp.Id); Assert.IsFalse(cat); }
public async Task Post() { var queryHandler = new StorageSpaceHandler(BasicNeeds); var query = new AddStorageSpace() { Name = "S1", Details = "description", CountyCode = "MH", Street = "Iancului 33", Building = "11", City = "Drobeta Turnu Severin", StorageSpaceType = Anabi.Common.Enums.StorageSpaceTypeEnum.Defendant }; await queryHandler.Handle(query, CancellationToken.None); var cat = await context.StorageSpaces.FirstOrDefaultAsync <StorageSpaceDb>(p => p.Name == "S1"); Assert.IsNotNull(cat); }