예제 #1
0
 public void TestLoad()
 {
     DatabaseController dc = new DatabaseController("testData/input.txt");
     string[] expected = { "1", "2", "3", "4", "5" };
     List<string[]> actual = dc.LoadData();
     for (int i = 0; i < 5; i++)
     {
         StringAssert.AreEqualIgnoringCase(expected[i], actual[0][i]);
     }
 }
예제 #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 TestSave()
        {
            string testPath = "testData/output.txt";
            File.WriteAllText(testPath, ""); //Ensure file exists and is blank

            DatabaseController dc = new DatabaseController(testPath);
            string toSaveLine = "1,2,3,4,5";
            List<string> toSave = new List<string>();
            toSave.Add(toSaveLine);
            dc.SaveData(toSave);

            string actual = File.ReadAllText(testPath);

            StringAssert.AreEqualIgnoringCase(toSaveLine + "\r\n", actual);
        }