public void TestListAllUncompletedNullUserTasksFromTheDatabase() { TaskBusiness mockTaskBusiness = new TaskBusiness(_mockContext.Object); User mockUser = null; Assert.Catch(() => mockTaskBusiness.ListAllUncompletedTasks(mockUser), "Null user uncompleted tasks were fetched!"); }
public void TestListAllUncompletedUserTasksFromTheDatabase() { TaskBusiness mockTaskBusiness = new TaskBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); string userName = "******"; string passwordHash = "passwordHash"; User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); int count = mockTaskBusiness.ListAllUncompletedTasks(mockUser).Count(); int expectedCount = mockTaskBusiness.GetPODbContext.Tasks.Where(x => x.UserId == mockUser.UserId && x.IsDone == false).ToList().Count(); Assert.AreEqual(expectedCount, count, "Not all tasks were fetched!"); }