コード例 #1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiEventModelMapper mapper = new ApiEventModelMapper();

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

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

            await this.Cleanup();
        }
コード例 #2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventResponseModel();

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

            response.ActualEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ActualStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.BillAmount.Should().Be(1m);
            response.EventStatusId.Should().Be(1);
            response.ScheduledEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ScheduledStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.StudentNote.Should().Be("A");
            response.TeacherNote.Should().Be("A");
        }
コード例 #3
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiEventResponseModel model = await client.EventGetAsync(1);

            ApiEventModelMapper mapper = new ApiEventModelMapper();

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

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
コード例 #4
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventResponseModel();

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

            response.Address1.Should().Be("A");
            response.Address2.Should().Be("A");
            response.CityId.Should().Be(1);
            response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Website.Should().Be("A");
        }
コード例 #5
0
        public void CreatePatch()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventRequestModel();

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

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

            patch.ApplyTo(response);
            response.ActualEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ActualStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.BillAmount.Should().Be(1m);
            response.EventStatusId.Should().Be(1);
            response.ScheduledEndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ScheduledStartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.StudentNote.Should().Be("A");
            response.TeacherNote.Should().Be("A");
        }
コード例 #6
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventResponseModel();

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

            response.AutoId.Should().Be(1);
            response.Category.Should().Be("A");
            response.EnvironmentId.Should().Be("A");
            response.JSON.Should().Be("A");
            response.Message.Should().Be("A");
            response.Occurred.Should().Be(DateTimeOffset.Parse("1/1/1987 12:00:00 AM"));
            response.ProjectId.Should().Be("A");
            response.RelatedDocumentIds.Should().Be("A");
            response.TenantId.Should().Be("A");
            response.UserId.Should().Be("A");
            response.Username.Should().Be("A");
        }
コード例 #7
0
        public void CreatePatch()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventRequestModel();

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

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

            patch.ApplyTo(response);
            response.Address1.Should().Be("A");
            response.Address2.Should().Be("A");
            response.CityId.Should().Be(1);
            response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Website.Should().Be("A");
        }
コード例 #8
0
        public void CreatePatch()
        {
            var mapper = new ApiEventModelMapper();
            var model  = new ApiEventRequestModel();

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

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

            patch.ApplyTo(response);
            response.AutoId.Should().Be(1);
            response.Category.Should().Be("A");
            response.EnvironmentId.Should().Be("A");
            response.JSON.Should().Be("A");
            response.Message.Should().Be("A");
            response.Occurred.Should().Be(DateTimeOffset.Parse("1/1/1987 12:00:00 AM"));
            response.ProjectId.Should().Be("A");
            response.RelatedDocumentIds.Should().Be("A");
            response.TenantId.Should().Be("A");
            response.UserId.Should().Be("A");
            response.Username.Should().Be("A");
        }