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 ApiProvinceRequestModel(); createModel.SetProperties(1, "B"); CreateResponse <ApiProvinceResponseModel> createResult = await client.ProvinceCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiProvinceResponseModel getResponse = await client.ProvinceGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.ProvinceDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiProvinceResponseModel verifyResponse = await client.ProvinceGetAsync(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()); ApiProvinceResponseModel response = await client.ProvinceGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IProvinceRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Province>(null)); var service = new ProvinceService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ProvinceModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLProvinceMapperMock, mock.DALMapperMockFactory.DALProvinceMapperMock, mock.BOLMapperMockFactory.BOLCityMapperMock, mock.DALMapperMockFactory.DALCityMapperMock, mock.BOLMapperMockFactory.BOLVenueMapperMock, mock.DALMapperMockFactory.DALVenueMapperMock); ApiProvinceResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiProvinceResponseModel response = await this.Client.ProvinceGetAsync(1); response.Should().NotBeNull(); }