Beispiel #1
0
        public async Task Should_Success_SendToAccounting()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentAsyncMethod());
            var serviceProviderMock = GetServiceProvider();

            var httpClientService = new Mock <IHttpClientService>();

            httpClientService
            .Setup(x => x.PutAsync(It.Is <string>(s => s.Contains("garment-purchasing-expeditions/internal-notes/position")), It.IsAny <HttpContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService)))
            .Returns(httpClientService.Object);

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(FinanceDbContext)))
            .Returns(dbContext);

            var service = new GarmentPurchasingExpeditionService(serviceProviderMock.Object);
            var formDto = GetDataUtil(service).GetNewData_SendToVerificationAccountingForm();

            //Act
            var result = await service.SendToAccounting(formDto);

            //Assert
            Assert.NotEqual(0, result);
        }
Beispiel #2
0
        public async Task Should_Success_GetByPosition()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentAsyncMethod());
            var serviceProviderMock = GetServiceProvider();

            var httpClientService = new Mock <IHttpClientService>();

            httpClientService
            .Setup(x => x.PutAsync(It.Is <string>(s => s.Contains("garment-purchasing-expeditions/internal-notes/position")), It.IsAny <HttpContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService)))
            .Returns(httpClientService.Object);

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(FinanceDbContext)))
            .Returns(dbContext);

            var service = new GarmentPurchasingExpeditionService(serviceProviderMock.Object);

            var dto = await GetDataUtil(service).GetTestData();

            //Act
            var result = service.GetByPosition("", 1, 10, "{}", GarmentPurchasingExpeditionPosition.SendToAccounting, 1, 1);

            //Assert
            Assert.NotNull(result);
        }
Beispiel #3
0
        public async Task Should_Success_SendToPurchasingRejected()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentAsyncMethod());
            var serviceProviderMock = GetServiceProvider();

            var httpClientService = new Mock <IHttpClientService>();

            httpClientService
            .Setup(x => x.PutAsync(It.Is <string>(s => s.Contains("garment-purchasing-expeditions/internal-notes/position")), It.IsAny <HttpContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService)))
            .Returns(httpClientService.Object);

            serviceProviderMock
            .Setup(serviceProvider => serviceProvider.GetService(typeof(FinanceDbContext)))
            .Returns(dbContext);

            var service = new GarmentPurchasingExpeditionService(serviceProviderMock.Object);

            var dto = await GetDataUtil(service).GetTestData();

            var ids = new List <int>();

            ids.Add(dto.Id);
            //Act
            var result = await service.SendToPurchasingRejected(dto.Id, dto.Remark);

            var result2 = await service.SendToPurchasingRejected(ids, dto.Remark);

            //Assert
            Assert.NotEqual(0, result);
            Assert.NotEqual(0, result2);
        }
Beispiel #4
0
 private GarmentPurchasingExpeditionDataUtil GetDataUtil(GarmentPurchasingExpeditionService service)
 {
     return(new GarmentPurchasingExpeditionDataUtil(service));
 }
Beispiel #5
0
 public GarmentPurchasingExpeditionDataUtil(GarmentPurchasingExpeditionService service)
 {
     _service = service;
 }