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 ApiChainStatusRequestModel(); createModel.SetProperties("B"); CreateResponse <ApiChainStatusResponseModel> createResult = await client.ChainStatusCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiChainStatusResponseModel getResponse = await client.ChainStatusGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.ChainStatusDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiChainStatusResponseModel verifyResponse = await client.ChainStatusGetAsync(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()); ApiChainStatusResponseModel response = await client.ChainStatusGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IChainStatusRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ChainStatus>(null)); var service = new ChainStatusService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ChainStatusModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLChainStatusMapperMock, mock.DALMapperMockFactory.DALChainStatusMapperMock, mock.BOLMapperMockFactory.BOLChainMapperMock, mock.DALMapperMockFactory.DALChainMapperMock); ApiChainStatusResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void ByName_Exists() { var mock = new ServiceMockFacade <IChainStatusRepository>(); var record = new ChainStatus(); mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record)); var service = new ChainStatusService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ChainStatusModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLChainStatusMapperMock, mock.DALMapperMockFactory.DALChainStatusMapperMock, mock.BOLMapperMockFactory.BOLChainMapperMock, mock.DALMapperMockFactory.DALChainMapperMock); ApiChainStatusResponseModel response = await service.ByName(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>())); }
public async void TestGet() { ApiChainStatusResponseModel response = await this.Client.ChainStatusGetAsync(1); response.Should().NotBeNull(); }