//private BudgieUserRepository budgieUserRepository;

        public BudgieUserLogic(BudgieUserRepository BudgieUserRepository, AccountRepository AccountRepository, AccountLogic AccountLogic)
        {
            budgieUserDB = BudgieUserRepository;
            accountDB    = AccountRepository;
            accountLogic = AccountLogic;
            bulist       = budgieUserDB.GetAllBudgieUsers();
        }
        public bool CheckForDuplicateEmail(string emailAddress)
        {
            List <BudgieUser> budgieusers = budgieUserDB.GetAllBudgieUsers();

            foreach (var info in budgieusers)
            {
                if (info.emailAddress == emailAddress)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #3
0
        public void Test_GetAllBrokers_ReturnsAllBrokers()
        {
            //ARRANGE
            Mock <BudgieUser> bb = new Mock <BudgieUser>();
            Mock <BudgieUser> an = new Mock <BudgieUser>();
            Mock <BudgieUser> sn = new Mock <BudgieUser>();

            var expected = new List <BudgieUser>
            {
                bb.Object,
                an.Object,
                sn.Object
                //new BudgieUser{ id = 1, firstName = "Ben", lastName = "Bowes", emailAddress = "*****@*****.**", dob = "040191", password = "******"},
                //new BudgieUser{ id = 1, firstName = "Andrew", lastName = "Norman", emailAddress = "*****@*****.**", dob = "010494", password = "******"},
            };

            var testData = new List <BudgieUser>
            {
                bb.Object,
                an.Object,
                sn.Object
            }.AsQueryable();

            dbSetMock.As <IQueryable <BudgieUser> >().Setup(d => d.Provider).Returns(testData.Provider);
            dbSetMock.As <IQueryable <BudgieUser> >().Setup(d => d.Expression).Returns(testData.Expression);
            dbSetMock.As <IQueryable <BudgieUser> >().Setup(d => d.ElementType).Returns(testData.ElementType);
            dbSetMock.As <IQueryable <BudgieUser> >().Setup(d => d.GetEnumerator()).Returns(testData.GetEnumerator);

            var contextMock = new Mock <BudgieDBCFModel>();

            contextMock.Setup(c => c.budgieUsers).Returns(dbSetMock.Object);

            BudgieUserRepository classUnderTest = new BudgieUserRepository(contextMock.Object);

            //ACT
            var actual = classUnderTest.GetAllBudgieUsers();

            //ASSERT
            CollectionAssert.AreEqual(expected, actual);
        }
 public ActionResult ListOfAllBudgieUsers()
 {
     return(View(userRepo.GetAllBudgieUsers()));
 }