Example #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 ApiLinkTypeRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiLinkTypeResponseModel> createResult = await client.LinkTypeCreateAsync(createModel);

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

            ApiLinkTypeResponseModel getResponse = await client.LinkTypeGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.LinkTypeDeleteAsync(2);

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

            ApiLinkTypeResponseModel verifyResponse = await client.LinkTypeGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Example #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());
            ApiLinkTypeResponseModel response = await client.LinkTypeGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <LinkType>(null));
            var service = new LinkTypeService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.LinkTypeModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLLinkTypeMapperMock,
                                              mock.DALMapperMockFactory.DALLinkTypeMapperMock);

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

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