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 ApiAirTransportRequestModel(); createModel.SetProperties("B", 1, 2, DateTime.Parse("1/1/1988 12:00:00 AM"), 2, DateTime.Parse("1/1/1988 12:00:00 AM")); CreateResponse <ApiAirTransportResponseModel> createResult = await client.AirTransportCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiAirTransportResponseModel getResponse = await client.AirTransportGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.AirTransportDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiAirTransportResponseModel verifyResponse = await client.AirTransportGetAsync(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()); ApiAirTransportResponseModel response = await client.AirTransportGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IAirTransportRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <AirTransport>(null)); var service = new AirTransportService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.AirTransportModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLAirTransportMapperMock, mock.DALMapperMockFactory.DALAirTransportMapperMock); ApiAirTransportResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiAirTransportResponseModel response = await this.Client.AirTransportGetAsync(1); response.Should().NotBeNull(); }