public async Task Test_Post() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/person", new StringContent( JsonConvert.SerializeObject( new YangdoDTO.Person() { FirstName = "KilDong", LastName = "Hong", Email = "*****@*****.**", Phone = "01012345678", DOB = Convert.ToDateTime("14/02/1981") } ) , Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); response.StatusCode.Should().Be(HttpStatusCode.Created); } }
public async Task Test_Post() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/timesheet", new StringContent( JsonConvert.SerializeObject( new YangdoDTO.TimeSheet() { PersonId = 1004, TaskId = 1003, TimeFrom = Convert.ToDateTime("2020-02-27 10:20:00"), TimeTo = Convert.ToDateTime("2020-02-27 12:37:00") } ) , Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); response.StatusCode.Should().Be(HttpStatusCode.Created); } }
public async Task Test_Post() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/task", new StringContent( JsonConvert.SerializeObject( new YangdoDTO.Task() { TaskName = "Design DB Schema", TaskDesc = "Design DB Schema - desc" } ) , Encoding.UTF8, "application/json")); response.EnsureSuccessStatusCode(); response.StatusCode.Should().Be(HttpStatusCode.Created); } }