public async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); var createModel = new ApiPaymentTypeRequestModel(); createModel.SetProperties("B"); CreateResponse <ApiPaymentTypeResponseModel> createResult = await client.PaymentTypeCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiPaymentTypeResponseModel getResponse = await client.PaymentTypeGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.PaymentTypeDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiPaymentTypeResponseModel verifyResponse = await client.PaymentTypeGetAsync(2); verifyResponse.Should().BeNull(); }
public async void TestGet() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiPaymentTypeResponseModel response = await client.PaymentTypeGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IPaymentTypeRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <PaymentType>(null)); var service = new PaymentTypeService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.PaymentTypeModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLPaymentTypeMapperMock, mock.DALMapperMockFactory.DALPaymentTypeMapperMock, mock.BOLMapperMockFactory.BOLSaleMapperMock, mock.DALMapperMockFactory.DALSaleMapperMock); ApiPaymentTypeResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiPaymentTypeResponseModel response = await this.Client.PaymentTypeGetAsync(1); response.Should().NotBeNull(); }