コード例 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiLinkLogModelMapper();
            var model  = new ApiLinkLogResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, "A");
            ApiLinkLogRequestModel response = mapper.MapResponseToRequest(model);

            response.DateEntered.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LinkId.Should().Be(1);
            response.Log.Should().Be("A");
        }
コード例 #2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiLinkLogModelMapper mapper = new ApiLinkLogModelMapper();

            UpdateResponse <ApiLinkLogResponseModel> updateResponse = await this.Client.LinkLogUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
コード例 #3
0
        public void CreatePatch()
        {
            var mapper = new ApiLinkLogModelMapper();
            var model  = new ApiLinkLogRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), 1, "A");

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

            patch.ApplyTo(response);
            response.DateEntered.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.LinkId.Should().Be(1);
            response.Log.Should().Be("A");
        }
コード例 #4
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiLinkLogResponseModel model = await client.LinkLogGetAsync(1);

            ApiLinkLogModelMapper mapper = new ApiLinkLogModelMapper();

            UpdateResponse <ApiLinkLogResponseModel> updateResponse = await client.LinkLogUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }