예제 #1
0
        public async Task <RealizationVbNonPOViewModel> GetTestData()
        {
            var model     = GetNewData();
            var viewmodel = GetNewViewModel();
            await Service.CreateAsync(model, viewmodel);

            return(await Service.ReadByIdAsync2(model.Id));
        }
예제 #2
0
        public async Task Should_Success_Read_ById()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(new RealizationVbNonPOServiceHelper());
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());
            var service       = new RealizationVbNonPOService(dbContext, serviceProviderMock.Object);
            var dataUtil      = new RealizationVBNonPODataUtil(service);
            var dataRequestVb = dataUtil.GetDataRequestVB();

            dbContext.VbRequests.Add(dataRequestVb);
            dbContext.SaveChanges();
            var data = await dataUtil.GetCreatedData();

            var result = await service.ReadByIdAsync2(data.Id);

            Assert.NotNull(result);
        }
예제 #3
0
        public async Task Should_Success_Read_ById()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProviderMock();
            var IVBRealizationDocumentExpeditionServiceMock = new Mock <IVBRealizationDocumentExpeditionService>();

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(IVBRealizationDocumentExpeditionServiceMock.Object);
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());

            var service  = new RealizationVbNonPOService(dbContext, serviceProviderMock.Object);
            var dataUtil = new RealizationVBNonPODataUtil(service);

            var data = await dataUtil.GetTestData();

            //Act
            var result = await service.ReadByIdAsync2(data.Id);

            //Assert
            Assert.NotNull(result);
        }