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 ApiAdminRequestModel(); createModel.SetProperties("B", "B", "B", "B", "B", "B"); CreateResponse <ApiAdminResponseModel> createResult = await client.AdminCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiAdminResponseModel getResponse = await client.AdminGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.AdminDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiAdminResponseModel verifyResponse = await client.AdminGetAsync(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()); ApiAdminResponseModel response = await client.AdminGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IAdminRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Admin>(null)); var service = new AdminService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.AdminModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLAdminMapperMock, mock.DALMapperMockFactory.DALAdminMapperMock); ApiAdminResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiAdminResponseModel response = await this.Client.AdminGetAsync(1); response.Should().NotBeNull(); }