public async Task Should_Success_CreateAsync() { var data = summarySampleData.GetNewData(); var Response = await repository.Create(data); Assert.NotEqual(0, Response); }
public async Task <InventorySummary> GetTestData() { InventorySummary invSum = GetNewData(); await _inventorySummaryRepository.Create(invSum); return(invSum); }
public async Task Should_Success_ValidateVM() { MaterialRequestNoteRepository repositoryMrn = new MaterialRequestNoteRepository(serviceProvider.Object, inventoryDbContext); InventorySummaryRepository InventorySummaryRepository = new InventorySummaryRepository(serviceProvider.Object, inventoryDbContext); serviceProvider.Setup(s => s.GetService(typeof(IInventorySummaryRepository))) .Returns(InventorySummaryRepository); await InventorySummaryRepository.Create(new InventorySummary() { StorageName = "Warehouse Here Finishing", UomUnit = "MTR", ProductCode = "Code", Quantity = 1 }); 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); serviceProvider.Setup(x => x.GetService(typeof(IMaterialRequestNoteRepository))) .Returns(repositoryMrn); MaterialDistributionNoteRepository repository = new MaterialDistributionNoteRepository(serviceProvider.Object, inventoryDbContext); var data = await DataUtil(repository, repositoryMrn).GetTestData(); var vm = repository.MapToViewModel(data); ValidationContext validationContext = new ValidationContext(vm, serviceProvider.Object, null); var response = vm.Validate(InventorySummaryRepository.GetByStorageAndMTR); Assert.True(response.Count() == 0); }