public async Task AddOrUpdatePerson_GivenInterestsRemoved_ShouldUpdate()
        {
            // Arrange
            using (PeopleSearchDbContext testContext = GetTestContext())
            {
                Person        added    = TestData.TestPerson1();
                Person        modified = TestData.TestPerson1();
                List <Person> expected = new List <Person> {
                    modified
                };

                testContext.People.Add(added);
                await testContext.SaveChangesAsync();

                modified.Id = added.Id;
                added.Interests.Clear();
                modified.Interests.Clear();

                PersonRepository repository = new PersonRepository(testContext);

                // Act
                await repository.AddOrUpdatePerson(added);

                // Assert
                List <Person> actual = await testContext.People.ToListAsync();

                ModelComparisonHelper.AssertPersonListsAreEqual(expected, actual);
            }
        }
        public async Task AddOrUpdatePerson_GivenPerson_ShouldReturnPersonCorrectly()
        {
            // Arrange
            using (PeopleSearchDbContext testContext = GetTestContext())
            {
                Person expected = TestData.TestPerson1();

                PersonRepository repository = new PersonRepository(testContext);

                // Act
                Person actual = await repository.AddOrUpdatePerson(expected);

                // Assert
                ModelComparisonHelper.AssertPeopleAreEqual(expected, actual);
            }
        }
        public async Task AddOrUpdatePerson_GivenNullPerson_ShouldNotAdd()
        {
            // Arrange
            using (PeopleSearchDbContext testContext = GetTestContext())
            {
                PersonRepository repository = new PersonRepository(testContext);

                int expected = 0;

                // Act
                await repository.AddOrUpdatePerson(null);

                // Assert
                int actual = await testContext.People.CountAsync();

                Assert.AreEqual(expected, actual);
            }
        }
        public async Task AddOrUpdatePerson_GivenPersonDoesNotExist_ShouldAdd()
        {
            // Arrange
            using (PeopleSearchDbContext testContext = GetTestContext())
            {
                Person        added    = TestData.TestPerson1();
                List <Person> expected = new List <Person> {
                    added
                };

                PersonRepository repository = new PersonRepository(testContext);

                // Act
                await repository.AddOrUpdatePerson(added);

                // Assert
                List <Person> actual = await testContext.People.ToListAsync();

                ModelComparisonHelper.AssertPersonListsAreEqual(expected, actual);
            }
        }