public async Task UpdateHiveSection_UpdateSuccessfuly_Test([Frozen] Mock <IProductStoreHiveContext> context, IFixture fixture, HiveSectionService hiveSectionService) { var listEntity = fixture.CreateMany <StoreHiveSection>(13).ToList(); listEntity[0].Name = "tests"; listEntity[0].Code = "tests"; context.Setup(x => x.Sections).ReturnsEntitySet(listEntity); var createRequest = fixture.Create <UpdateHiveSectionRequest>(); var addedHive = await hiveSectionService.UpdeteHiveSectionAsync(listEntity[0].Id, createRequest); var hiveSection = await hiveSectionService.GetHiveSectionAsync(addedHive.Id); Assert.Equal(hiveSection.Id, listEntity[0].Id); Assert.Equal(hiveSection.Name, createRequest.Name); Assert.Equal(hiveSection.Code, createRequest.Code); }
public async Task DeleteHiveSection_NotFoundException_Test([Frozen] Mock <IProductStoreHiveContext> context, IFixture fixture, HiveSectionService hiveSectionService, int hiveSectionId) { var listEntity = fixture.CreateMany <StoreHiveSection>(13).ToList(); var createRequest = fixture.Create <UpdateHiveSectionRequest>(); context.Setup(x => x.Sections).ReturnsEntitySet(listEntity); var ex = await Assert.ThrowsAsync <RequestedResourceNotFoundException>(() => hiveSectionService.UpdeteHiveSectionAsync(hiveSectionId, createRequest)); Assert.Equal(typeof(RequestedResourceNotFoundException), ex.GetType()); }