public void TestListAllNullUserEventsFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); User mockUser = null; Assert.Catch(() => mockEventBusiness.ListAllEvents(mockUser), "Null user events were fetched!"); }
public void TestListAllUserEventsFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); string userName = "******"; string passwordHash = "passwordHash"; User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); int count = mockEventBusiness.ListAllEvents(mockUser).Count(); int expectedCount = mockEventBusiness.GetPODbContext.Events.Where(x => x.UserId == mockUser.UserId).ToList().Count(); Assert.AreEqual(expectedCount, count, "Not all events were fetched!"); }