コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }