public void GetContacts_DoesNotReturnExistingContact_IfSearchTermIsUsed_BecauseUserIsNotRecordOwner() { var repository = new PhoneBookRepository(_soundexFilter) { ConnectionString = _connectionString }; repository.SetOwnerGuid(Guid.NewGuid()); var results = repository.GetContacts("Lenna Paprocki"); Assert.DoesNotContain(results, contact => contact.FirstName == "Lenna" && contact.LastName == "Paprocki"); }
public void GetContacts_ReturnsExactContact_IfProperSearchTermIsUsed() { var repository = new PhoneBookRepository(_soundexFilter) { ConnectionString = _connectionString }; repository.SetOwnerGuid(_guid); var results = repository.GetContacts("Lena Paprocki"); Assert.Contains(results, contact => contact.FirstName == "Lenna" && contact.LastName == "Paprocki"); }
public void GetContacts_ReturnsPagedContactList_WithoutParameter() { var repository = new PhoneBookRepository(_soundexFilter) { ConnectionString = _connectionString }; repository.SetOwnerGuid(_guid); var expected = repository.PageSize; var result = repository.GetContacts().Count; Assert.Equal(expected, result); }
public void GetContacts_ReturnsPagedContactList_InAlphabeticalOrder() { var repository = new PhoneBookRepository(_soundexFilter) { ConnectionString = _connectionString }; repository.SetOwnerGuid(_guid); var result = repository.GetContacts(); var expected = result.OrderBy(contact => contact.LastName).ThenBy(contact => contact.FirstName); Assert.Equal(expected,result); }