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

            createModel.SetProperties(2, 2);
            CreateResponse <ApiPersonRefResponseModel> createResult = await client.PersonRefCreateAsync(createModel);

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

            ApiPersonRefResponseModel getResponse = await client.PersonRefGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PersonRefDeleteAsync(2);

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

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

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <PersonRef>(null));
            var service = new PersonRefService(mock.LoggerMock.Object,
                                               mock.RepositoryMock.Object,
                                               mock.ModelValidatorMockFactory.PersonRefModelValidatorMock.Object,
                                               mock.BOLMapperMockFactory.BOLPersonRefMapperMock,
                                               mock.DALMapperMockFactory.DALPersonRefMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Example #4
0
        public async void TestGet()
        {
            ApiPersonRefResponseModel response = await this.Client.PersonRefGetAsync(1);

            response.Should().NotBeNull();
        }