コード例 #1
0
        public void TestListAllNullUserRemindersFromTheDatabase()
        {
            ReminderBusiness mockReminderBusiness = new ReminderBusiness(_mockContext.Object);

            User mockUser = null;

            Assert.Catch(() => mockReminderBusiness.ListAllReminders(mockUser), "Null user reminders were fetched!");
        }
コード例 #2
0
        public void TestListAllUserRemindersFromTheDatabase()
        {
            ReminderBusiness mockReminderBusiness = new ReminderBusiness(_mockContext.Object);
            UserBusiness     mockUserBusiness     = new UserBusiness(_mockContext.Object);

            string userName     = "******";
            string passwordHash = "passwordHash";

            User mockUser = mockUserBusiness.FetchUser(userName, passwordHash);

            int count         = mockReminderBusiness.ListAllReminders(mockUser).Count();
            int expectedCount = mockReminderBusiness.GetPODbContext.Reminders.Where(x => x.UserId == mockUser.UserId).ToList().Count();

            Assert.AreEqual(expectedCount, count, "Not all reminders were fetched!");
        }