Beispiel #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 ApiLinkStatusRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiLinkStatusResponseModel> createResult = await client.LinkStatusCreateAsync(createModel);

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

            ApiLinkStatusResponseModel getResponse = await client.LinkStatusGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.LinkStatusDeleteAsync(2);

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

            ApiLinkStatusResponseModel verifyResponse = await client.LinkStatusGetAsync(2);

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

            model.SetProperties("B");
            CreateResponse <ApiLinkStatusResponseModel> result = await client.LinkStatusCreateAsync(model);

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

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

            response.Name.Should().Be("A");
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiLinkStatusModelMapper();
            var model  = new ApiLinkStatusRequestModel();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiLinkStatusModelMapper();
            var model  = new ApiLinkStatusRequestModel();

            model.SetProperties("A");

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

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