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 ApiTicketStatuRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiTicketStatuResponseModel> createResult = await client.TicketStatuCreateAsync(createModel);

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

            ApiTicketStatuResponseModel getResponse = await client.TicketStatuGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TicketStatuDeleteAsync(2);

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

            ApiTicketStatuResponseModel verifyResponse = await client.TicketStatuGetAsync(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());
            ApiTicketStatuResponseModel response = await client.TicketStatuGetAsync(1);

            response.Should().NotBeNull();
        }
Example #3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ITicketStatuRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <TicketStatu>(null));
            var service = new TicketStatuService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.TicketStatuModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLTicketStatuMapperMock,
                                                 mock.DALMapperMockFactory.DALTicketStatuMapperMock,
                                                 mock.BOLMapperMockFactory.BOLTicketMapperMock,
                                                 mock.DALMapperMockFactory.DALTicketMapperMock);

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

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