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

            createModel.SetProperties(2m, "B", 1);
            CreateResponse <ApiTransactionResponseModel> createResult = await client.TransactionCreateAsync(createModel);

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

            ApiTransactionResponseModel getResponse = await client.TransactionGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TransactionDeleteAsync(2);

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

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

            response.Should().NotBeNull();
        }
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ITransactionRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Transaction>(null));
            var service = new TransactionService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.TransactionModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLTransactionMapperMock,
                                                 mock.DALMapperMockFactory.DALTransactionMapperMock,
                                                 mock.BOLMapperMockFactory.BOLSaleMapperMock,
                                                 mock.DALMapperMockFactory.DALSaleMapperMock);

            ApiTransactionResponseModel 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()
        {
            ApiTransactionResponseModel response = await this.Client.TransactionGetAsync(1);

            response.Should().NotBeNull();
        }