Esempio 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 ApiTicketRequestModel();

            createModel.SetProperties("B", 1);
            CreateResponse <ApiTicketResponseModel> createResult = await client.TicketCreateAsync(createModel);

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

            ApiTicketResponseModel getResponse = await client.TicketGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TicketDeleteAsync(2);

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

            ApiTicketResponseModel verifyResponse = await client.TicketGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Esempio 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());
            ApiTicketResponseModel response = await client.TicketGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Ticket>(null));
            var service = new TicketService(mock.LoggerMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.TicketModelValidatorMock.Object,
                                            mock.BOLMapperMockFactory.BOLTicketMapperMock,
                                            mock.DALMapperMockFactory.DALTicketMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Esempio n. 4
0
        public async void TestGet()
        {
            ApiTicketResponseModel response = await this.Client.TicketGetAsync(1);

            response.Should().NotBeNull();
        }