public void TestFetchEventByIdWithNullUserFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); int eventId = 5; User mockUser = null; Assert.Catch(() => mockEventBusiness.FetchEventById(eventId, mockUser), "Non existent event was fetched!"); }
public void TestFetchNonExistentEventByIdFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); int eventId = 5; string userName = "******"; string passwordHash = "passwordHash"; User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); Assert.Catch(() => mockEventBusiness.FetchEventById(eventId, mockUser), "Non existent event was fetched!"); }
public void TestFetchEventByIdFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); int eventId = 1; string userName = "******"; string passwordHash = "passwordHash"; User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); Event mockEvent = mockEventBusiness.FetchEventById(eventId, mockUser); Assert.AreEqual(eventId, mockEvent.EventId, "Wrong event was fetched!"); }