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

            createModel.SetProperties("B");
            CreateResponse <ApiPostHistoryTypeResponseModel> createResult = await client.PostHistoryTypeCreateAsync(createModel);

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

            ApiPostHistoryTypeResponseModel getResponse = await client.PostHistoryTypeGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PostHistoryTypeDeleteAsync(2);

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

            ApiPostHistoryTypeResponseModel verifyResponse = await client.PostHistoryTypeGetAsync(2);

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

            model.SetProperties("B");
            CreateResponse <ApiPostHistoryTypeResponseModel> result = await client.PostHistoryTypeCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapModelToBO()
        {
            var mapper = new BOLPostHistoryTypeMapper();
            ApiPostHistoryTypeRequestModel model = new ApiPostHistoryTypeRequestModel();

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

            response.Type.Should().Be("A");
        }
Example #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiPostHistoryTypeModelMapper();
            var model  = new ApiPostHistoryTypeRequestModel();

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

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

            model.SetProperties("A");

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

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