public async Task Should_Success_DeleteAsync() { MaterialRequestNoteRepository repositoryMrn = new MaterialRequestNoteRepository(serviceProvider.Object, inventoryDbContext); InventorySummaryRepository inventorySummaryRepository = new InventorySummaryRepository(serviceProvider.Object, inventoryDbContext); serviceProvider.Setup(s => s.GetService(typeof(IInventorySummaryRepository))) .Returns(inventorySummaryRepository); InventoryMovementRepository inventoryMovementRepository = new InventoryMovementRepository(serviceProvider.Object, inventoryDbContext); serviceProvider.Setup(s => s.GetService(typeof(IInventoryMovementRepository))) .Returns(inventoryMovementRepository); InventoryDocumentRepository inventoryDocumentRepository = new InventoryDocumentRepository(serviceProvider.Object, inventoryDbContext); serviceProvider.Setup(s => s.GetService(typeof(IInventoryDocumentRepository))) .Returns(inventoryDocumentRepository); var mrn = await DataUtilMrn(repositoryMrn).GetTestData(); serviceProvider.Setup(x => x.GetService(typeof(IMaterialRequestNoteRepository))) .Returns(repositoryMrn); MaterialDistributionNoteRepository repository = new MaterialDistributionNoteRepository(serviceProvider.Object, inventoryDbContext); var data = await DataUtil(repository, repositoryMrn).GetTestData(); var response = await repository.DeleteAsync(data.Id); Assert.NotEqual(0, response); }
public async Task Should_Fail_DeleteAsync() { MaterialRequestNoteRepository repositoryMrn = new MaterialRequestNoteRepository(serviceProvider.Object, inventoryDbContext); MaterialDistributionNoteRepository repository = new MaterialDistributionNoteRepository(getFailServiceProvider.Object, inventoryDbContext); await Assert.ThrowsAnyAsync <Exception>(() => repository.DeleteAsync(0)); }