Пример #1
0
        public async Task Should_Success_CreateAsync()
        {
            var data     = summarySampleData.GetNewData();
            var Response = await repository.Create(data);

            Assert.NotEqual(0, Response);
        }
Пример #2
0
        public async Task <InventorySummary> GetTestData()
        {
            InventorySummary invSum = GetNewData();

            await _inventorySummaryRepository.Create(invSum);

            return(invSum);
        }
Пример #3
0
        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);
        }