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 ApiLinkRequestModel(); createModel.SetProperties(1, 1, DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), 1, "B", 2, "B", "B", 2); CreateResponse<ApiLinkResponseModel> createResult = await client.LinkCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiLinkResponseModel getResponse = await client.LinkGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.LinkDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiLinkResponseModel verifyResponse = await client.LinkGetAsync(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()); ApiLinkResponseModel response = await client.LinkGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <ILinkRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Link>(null)); var service = new LinkService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLLinkMapperMock, mock.DALMapperMockFactory.DALLinkMapperMock, mock.BOLMapperMockFactory.BOLLinkLogMapperMock, mock.DALMapperMockFactory.DALLinkLogMapperMock); ApiLinkResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void ByExternalId_Not_Exists() { var mock = new ServiceMockFacade <ILinkRepository>(); mock.RepositoryMock.Setup(x => x.ByExternalId(It.IsAny <Guid>())).Returns(Task.FromResult <Link>(null)); var service = new LinkService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLLinkMapperMock, mock.DALMapperMockFactory.DALLinkMapperMock, mock.BOLMapperMockFactory.BOLLinkLogMapperMock, mock.DALMapperMockFactory.DALLinkLogMapperMock); ApiLinkResponseModel response = await service.ByExternalId(default(Guid)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.ByExternalId(It.IsAny <Guid>())); }
public async void TestGet() { ApiLinkResponseModel response = await this.Client.LinkGetAsync(1); response.Should().NotBeNull(); }