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

            createModel.SetProperties("B");
            CreateResponse <ApiVoteTypeResponseModel> createResult = await client.VoteTypeCreateAsync(createModel);

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

            ApiVoteTypeResponseModel getResponse = await client.VoteTypeGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.VoteTypeDeleteAsync(2);

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

            ApiVoteTypeResponseModel verifyResponse = await client.VoteTypeGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Example #2
0
        private async Task <ApiVoteTypeResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiVoteTypeRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiVoteTypeResponseModel> result = await client.VoteTypeCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Example #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLVoteTypeMapper();
            ApiVoteTypeRequestModel model = new ApiVoteTypeRequestModel();

            model.SetProperties("A");
            BOVoteType response = mapper.MapModelToBO(1, model);

            response.Name.Should().Be("A");
        }
Example #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiVoteTypeModelMapper();
            var model  = new ApiVoteTypeRequestModel();

            model.SetProperties("A");
            ApiVoteTypeResponseModel response = mapper.MapRequestToResponse(1, model);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Example #5
0
        public void CreatePatch()
        {
            var mapper = new ApiVoteTypeModelMapper();
            var model  = new ApiVoteTypeRequestModel();

            model.SetProperties("A");

            JsonPatchDocument <ApiVoteTypeRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiVoteTypeRequestModel();

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }