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 ApiDestinationRequestModel(); createModel.SetProperties(1, "B", 2); CreateResponse <ApiDestinationResponseModel> createResult = await client.DestinationCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiDestinationResponseModel getResponse = await client.DestinationGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.DestinationDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiDestinationResponseModel verifyResponse = await client.DestinationGetAsync(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()); ApiDestinationResponseModel response = await client.DestinationGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IDestinationRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Destination>(null)); var service = new DestinationService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.DestinationModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLDestinationMapperMock, mock.DALMapperMockFactory.DALDestinationMapperMock); ApiDestinationResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiDestinationResponseModel response = await this.Client.DestinationGetAsync(1); response.Should().NotBeNull(); }