Esempio n. 1
0
        public void TestHappyPath_WhenUserResignedFromEventSuccessfullyMoneyIsReturnedToUsersAccount()
        {
            //GIVEN
            var        user    = new User("user1");
            IDBAdapter adapter = new MockDB();

            adapter.RecordData(new EventGig("Jazz Concert", 50), user, 50);

            var eventManager = new EventManager(adapter);
            //WHEN
            var events = eventManager.GetEventsForUser(user);

            eventManager.ResignFromEventForUser(user, events[0]);

            //THEN
            Assert.AreEqual(50, user.Account.Value);
        }
Esempio n. 2
0
        public void TestHappyPath_ShowEventsForUser()
        {
            //GIVEN
            var        user    = new User("user1");
            IDBAdapter adapter = new MockDB();
            var        gig     = new EventGig("Jazz Concert", 50);

            adapter.RecordData(gig, user, 50);

            var eventManager = new EventManager(adapter);

            //WHEN
            var events = eventManager.GetEventsForUser(user);

            //THEN
            Assert.AreEqual(1, events.Count);
            Assert.AreEqual(gig, events[0]);
        }
Esempio n. 3
0
        public void TestHappyPath_WhenUserResignedFromEventThisEventIsNoLongerInHisEventsList()
        {
            //GIVEN
            var        user    = new User("user1");
            IDBAdapter adapter = new MockDB();

            adapter.RecordData(new EventGig("Jazz Concert", 50), user, 50);

            var eventManager = new EventManager(adapter);
            //WHEN
            var events = eventManager.GetEventsForUser(user);

            eventManager.ResignFromEventForUser(user, events[0]);

            var updatedEvents = eventManager.GetEventsForUser(user);

            //THEN
            Assert.AreEqual(0, updatedEvents.Count);
        }
Esempio n. 4
0
        public void RezygnacjaUnhappyPathTest_WhenUserResignsFromEventThatIsNotOnHisEventsListAErrorMessageIsAddedToMessageWindowAndAccountValueIsNotModified()
        {
            //GIVEN
            var        user    = new User("user1");
            IDBAdapter adapter = new MockDB();

            adapter.RecordData(new EventGig("Jazz Concert", 50), user, 50);

            var eventManager     = new EventManager(adapter);
            var nonExistantEvent = new EventGig("Folk Concert", 125);
            int eventsCount      = eventManager.GetEventsForUser(user).Count;
            int money            = user.Account.Value;
            int oldMessageCount  = MessageQueue.MessageCount(user);

            //WHEN
            eventManager.ResignFromEventForUser(user, nonExistantEvent);

            //THEN
            Assert.AreNotEqual(MessageQueue.MessageCount(user), oldMessageCount);
            Assert.AreEqual(money, user.Account.Value);
        }