コード例 #1
0
        public void TestCreateNewActivity()
        {
            string testActivity = "Running";
            DateTime testDate = new DateTime(2000, 01, 01);
            Profile myProfile = new Profile();

            Activity myActivity = new Activity();

            StringAssert.AreEqualIgnoringCase(testActivity, myActivity.Name, "Name the same");
        }
コード例 #2
0
 //Constructor
 /// <summary>
 /// Default Constructor for Controller
 /// </summary>
 public Controller()
 {
     _users = new List<Profile>();
     _activities = new List<Activity>();
     _profileDatabase = new DatabaseController("info/profiles.txt");
     _activityDatabase = new DatabaseController("info/activities.txt");
     _Menu = new MenuController();
     Quit = false;
     currentLogin = null;
     currentActivity = null;
 }
コード例 #3
0
        public void TestCreateCustomActivity()
        {
            string testActivity = "Tennis";
            string testLocation = "Rodlaver Arena";
            string testDescription = "TEST";
            DateTime testDate = new DateTime(2000, 01, 01);
            Profile myProfile = new Profile();

            Activity activity = new Activity(myProfile, "Tennis", "7:30", testDate, "Rodlaver Arena", "TEST");

            Assert.AreSame(testActivity, activity.Name);
            Assert.AreSame(testLocation, activity.Location);
            Assert.AreSame(testDescription, activity.Description);
        }
コード例 #4
0
 /// <summary>
 /// Run the app. Do the next thing. 
 /// </summary>
 public void RunApp()
 {
     string input = "";
     while (input != "quit")
     {
         if (currentLogin == null)
         {
             LoginCreation();
         }
         else
         {
             //Display menu
             input = _Menu.MainMenu("Welcome user: "******" (" + currentLogin.Name + ", " + currentLogin.Age + ", " + currentLogin.Location + ")");
             if (input == "Activity")
             {
                 input = _Menu.ActivityMenu("Welcome user: "******" (" + currentLogin.Name + ", " + currentLogin.Age + ", " + currentLogin.Location + ")");
                 if (input == "Create")
                 {
                     //Create new activity and add to _activities
                     string[] temp = _Menu.CreateActivity().Split(',');
                     var make = new String[temp.Length + 1];
                     temp.CopyTo(make, 1);
                     make[0] = currentLogin.Username;
                     Activity newActivity = MakeActivityFromStringArray(make);
                     _activities.Add(newActivity);
                     currentActivity = newActivity;
                     input = "Activity";
                 }
                 else if (input == "View")
                 {
                     //Initial code for viewing activities. This is just to view current activity.
                     List<Activity> myActivities = new List<Activity>();
                     foreach (Activity a in _activities)
                     {
                         if (currentLogin == a.Owner)
                         {
                             myActivities.Add(a);
                         }
                     }
                     Console.Clear();
                     Console.WriteLine("Welcome user: "******" (" + currentLogin.Name + ", " + currentLogin.Age + ", " + currentLogin.Location + ")");
                     Console.WriteLine("Your activities:");
                     foreach (Activity a in myActivities)
                     {
                         Console.WriteLine("Activity: {0}, Location: {1}, Time: {2}, Description: {3} ", a.Name, a.Location, a.Time, a.Description);
                     }
                     Console.WriteLine("Enter to return");
                     Console.ReadLine();
                     input = "Activity";
                 }
                 else
                 {
                     input = "";
                 }
             }
             else if (input == "Profile")
             {
                 //To do add profile viewing and editing
             }
             else if (input == "logout")
             {
                 currentLogin = null;
             }
             else
             {
                 //Console.ReadLine();//Force wait for input, will display submenus not yet implemented, causes double enter on quit
             }
         }
         Quit = false;
     }
     Quit = true;
 }