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

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

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

            ApiVersionInfoModelMapper mapper = new ApiVersionInfoModelMapper();

            UpdateResponse <ApiVersionInfoResponseModel> updateResponse = await this.Client.VersionInfoUpdateAsync(model.Version, mapper.MapResponseToRequest(model));

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

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

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

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

            patch.ApplyTo(response);
            response.AppliedOn.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.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());

            ApiVersionInfoResponseModel model = await client.VersionInfoGetAsync(1);

            ApiVersionInfoModelMapper mapper = new ApiVersionInfoModelMapper();

            UpdateResponse <ApiVersionInfoResponseModel> updateResponse = await client.VersionInfoUpdateAsync(model.Version, mapper.MapResponseToRequest(model));

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