Exemplo n.º 1
0
        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 ApiPipelineStatuRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiPipelineStatuResponseModel> createResult = await client.PipelineStatuCreateAsync(createModel);

            createResult.Success.Should().BeTrue();

            ApiPipelineStatuResponseModel getResponse = await client.PipelineStatuGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PipelineStatuDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();

            ApiPipelineStatuResponseModel verifyResponse = await client.PipelineStatuGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 2
0
        public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiPipelineStatuResponseModel response = await client.PipelineStatuGetAsync(1);

            response.Should().NotBeNull();
        }
Exemplo n.º 3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IPipelineStatuRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <PipelineStatu>(null));
            var service = new PipelineStatuService(mock.LoggerMock.Object,
                                                   mock.RepositoryMock.Object,
                                                   mock.ModelValidatorMockFactory.PipelineStatuModelValidatorMock.Object,
                                                   mock.BOLMapperMockFactory.BOLPipelineStatuMapperMock,
                                                   mock.DALMapperMockFactory.DALPipelineStatuMapperMock,
                                                   mock.BOLMapperMockFactory.BOLPipelineMapperMock,
                                                   mock.DALMapperMockFactory.DALPipelineMapperMock);

            ApiPipelineStatuResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }