Esempio n. 1
0
        public void TestCurrentActivityConstructor()
        {
            Activity testActivity = new Activity("John Doe", "Complete me", 3, 4, null);
            CurrentActivity currActivity = new CurrentActivity(testActivity);

            Assert.AreEqual(testActivity, currActivity.Activity);
            Assert.AreEqual(testActivity.Time, currActivity.TimeLeft);
        }
Esempio n. 2
0
        /// <summary>
        /// Gives the user a new activity to perform. Can not already be doing an activity.
        /// </summary>
        /// <param name="newActivity">New activity to start with.</param>
        public void SetCurrentActivity(Activity newActivity)
        {
            // can not start a new activity before completing the old one
            if (CurrentActivity != null)
            {
                throw new AlreadyInActivityException("Already performing an activity.");
            }

            // new activity is set for the user
            CurrentActivity = new CurrentActivity(newActivity);
            string name = CurrentActivity.Activity.Name;
            Debug.WriteLine(name);
        }
Esempio n. 3
0
        /// <summary>
        /// Gives the user a new activity to perform. Can not already be doing an activity.
        /// </summary>
        /// <param name="newActivity">New activity to start with.</param>
        public void SetCurrentActivity(Activity newActivity)
        {
            // can not start a new activity before completing the old one
            if (CurrentActivity != null)
            {
                throw new AlreadyInActivityException("Already performing an activity.");
            }

            // new activity is set for the user
            CurrentActivity = new CurrentActivity(newActivity);
            string name = CurrentActivity.Activity.Name;

            Debug.WriteLine(name);
        }
Esempio n. 4
0
        public void TestTotalPoints()
        {
            string UserName = "******";
            User User = new User(UserName);
            User.AddMood(MoodType.Sad);
            List<MoodType> CuresMoods = new List<MoodType>();
            CuresMoods.Add(MoodType.Sad);
            Activity Activity = new Activity("test", "Check this out", 8, 0, CuresMoods);
            CurrentActivity CurrentActivity = new CurrentActivity(Activity);

            List<Trophy> TrophyList = User.CompleteActivity(CurrentActivity, ActivityGrade.Good, "Need more time");
            Assert.AreEqual(8, User.TotalPoints());
        }
Esempio n. 5
0
        public void TestCompleteActivityWithTimeLeft()
        {
            string UserName = "******";
            User User = new User(UserName);
            List<MoodType> CuresMoods = new List<MoodType>();
            CuresMoods.Add(MoodType.Sad);
            Activity Activity = new Activity("test", "Check this out", 8, 3, CuresMoods);
            CurrentActivity CurrentActivity = new CurrentActivity(Activity);

            List<Trophy> TrophyList = User.CompleteActivity(CurrentActivity, ActivityGrade.Good, "Need more time");

            Assert.AreEqual(0, TrophyList.Count);
        }