public async void TestUpdate() { var model = await this.CreateRecord(); ApiLessonModelMapper mapper = new ApiLessonModelMapper(); UpdateResponse <ApiLessonResponseModel> updateResponse = await this.Client.LessonUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiLessonModelMapper(); var model = new ApiLessonResponseModel(); 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", 1, "A"); ApiLessonRequestModel 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.LessonStatusId.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.StudentNotes.Should().Be("A"); response.StudioId.Should().Be(1); response.TeacherNotes.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiLessonModelMapper(); var model = new ApiLessonRequestModel(); 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", 1, "A"); JsonPatchDocument <ApiLessonRequestModel> patch = mapper.CreatePatch(model); var response = new ApiLessonRequestModel(); 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.LessonStatusId.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.StudentNotes.Should().Be("A"); response.StudioId.Should().Be(1); response.TeacherNotes.Should().Be("A"); }