示例#1
0
        public async Task Should_Success_Delete_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.DeleteAsync(data.Id);

            Assert.NotEqual(0, result);
        }
示例#2
0
        public async Task Should_Success_Delete_ById2()
        {
            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 data     = await dataUtil.GetCreatedData2();

            var dataRequestVb = dataUtil.GetDataRequestVB();

            dbContext.VbRequests.Add(dataRequestVb);
            dbContext.SaveChanges();

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

            Assert.NotEqual(0, result);
        }