public async Task CanEditPerson() { var factory = new TestWebApplicationFactory(); var client = factory.CreateClient(); factory.AddTestData(TestData.CreateTestPeople()); var httpRepo = new PersonClientRepository(client); var person = await httpRepo.EditPerson(TestData.JaneSmith.Id, new EditPersonParameters { LastName = TestData.JohnDoe.LastName }).ConfigureAwait(false); // Ensure that we received an instance of Person. Assert.IsNotNull(person); // Ensure that the last name has changed to the expected value. Assert.AreEqual(TestData.JohnDoe.LastName, person.LastName); }
public async Task CanEditPersonAndSetNullProperty() { var factory = new TestWebApplicationFactory(); var client = factory.CreateClient(); factory.AddTestData(TestData.CreateTestPeople()); var httpRepo = new PersonClientRepository(client); var person = await httpRepo.EditPerson(TestData.JaneSmith.Id, new EditPersonParameters { LastName = null }).ConfigureAwait(false); // Ensure that we received an instance of Person. Assert.IsNotNull(person); // Ensure that the last name was removed (set to null). Assert.IsNull(person.LastName); // Ensure that the other field was unmodified. Assert.AreEqual(TestData.JaneSmith.FirstName, person.FirstName); }