Ejemplo n.º 1
0
        public void BelongsToOthersReturnsCorrectly()
        {
            //Arrange
            long emailId = 1;
            List <PersonEmails> emails = new List <PersonEmails>
            {
                new PersonEmails {
                    EmailId = emailId
                },
                new PersonEmails {
                    EmailId = emailId
                },
                new PersonEmails {
                    EmailId = emailId + 1
                },
                new PersonEmails {
                    EmailId = emailId + 2
                }
            };
            var dbSet = emails.AsQueryable().BuildMockDbSet();

            context.Setup(c => c.PersonEmails).Returns(dbSet.Object);
            IEmailRepository repository = new EmailRepository(context.Object);

            //Act
            var result = repository.BelongToOthers(emailId).Result;

            //Assert
            Assert.IsInstanceOfType(result, typeof(bool));
            Assert.IsTrue(result);
        }