예제 #1
0
        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!");
        }
예제 #2
0
        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!");
        }
예제 #3
0
        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!");
        }