public void TestDeleteNonExistentEventFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); int eventId = 3; string userName = "******"; string passwordHash = "passwordHash"; User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); Assert.Catch(() => mockEventBusiness.RemoveEvent(eventId, mockUser), "Non existent event was deleted!"); }
public void TestDeleteEventFromTheDatabase() { EventBusiness mockEventBusiness = new EventBusiness(_mockContext.Object); UserBusiness mockUserBusiness = new UserBusiness(_mockContext.Object); int eventId = 1; string userName = "******"; string passwordHash = "passwordHash"; int oldCount = mockEventBusiness.GetPODbContext.Events.ToList().Count(); User mockUser = mockUserBusiness.FetchUser(userName, passwordHash); mockEventBusiness.RemoveEvent(eventId, mockUser); Assert.Less(mockEventBusiness.GetPODbContext.Events.ToList().Count(), oldCount, "Event not deleted properly!"); }