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 ApiSaleRequestModel(); createModel.SetProperties(2m, "B", "B", 1, 1, "B"); CreateResponse <ApiSaleResponseModel> createResult = await client.SaleCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiSaleResponseModel getResponse = await client.SaleGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.SaleDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiSaleResponseModel verifyResponse = await client.SaleGetAsync(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()); ApiSaleResponseModel response = await client.SaleGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <ISaleRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Sale>(null)); var service = new SaleService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.SaleModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLSaleMapperMock, mock.DALMapperMockFactory.DALSaleMapperMock); ApiSaleResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiSaleResponseModel response = await this.Client.SaleGetAsync(1); response.Should().NotBeNull(); }