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

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            ApiBusinessEntityRequestModel response = mapper.MapResponseToRequest(model);

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
コード例 #2
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiBusinessEntityModelMapper mapper = new ApiBusinessEntityModelMapper();

            UpdateResponse <ApiBusinessEntityResponseModel> updateResponse = await this.Client.BusinessEntityUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model));

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

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

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));

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

            patch.ApplyTo(response);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
コード例 #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());

            ApiBusinessEntityResponseModel model = await client.BusinessEntityGetAsync(1);

            ApiBusinessEntityModelMapper mapper = new ApiBusinessEntityModelMapper();

            UpdateResponse <ApiBusinessEntityResponseModel> updateResponse = await client.BusinessEntityUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model));

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