Example #1
0
        public void Run()
        {
            UserActions action;

            do
            {
                action = DetermineAction();
                PerformAction(action);
            } while (!(action == UserActions.Exit));

            file.Save(list, input);
        }
Example #2
0
        public void SecondSaveShouldDefaultToSameFilePathAsFirst()
        {
            TestStorage  saveSensor = new TestStorage();
            TaskListFile file       = new TaskListFile(saveSensor);

            file.Save(new TaskList(), new TestInputParser(new List <string> {
                "TestFileName"
            }));

            saveSensor.Clear();
            file.Save(new TaskList(), new TestInputParser(new List <string> {
            }));
            Assert.AreEqual("TestFileName", saveSensor.SavedFile, string.Format("Saved file name should be TestFileName, not {0}", saveSensor.SavedFile));
        }
Example #3
0
        public void SaveAfterLoadShouldDefaultToFileThatWasLoaded()
        {
            TestStorage  saveSensor = new TestStorage();
            TaskListFile file       = new TaskListFile(saveSensor);

            file.Load("LoadTestFile");

            file.Save(new TaskList(), new TestInputParser(new List <string> {
            }));                                                                  //null

            saveSensor.Clear();
            file.Save(new TaskList(), new TestInputParser(new List <string> {
            }));                                                                  //string.Empty
            Assert.AreEqual("LoadTestFile", saveSensor.SavedFile, string.Format("Saved file name should be LoadTestFile, not {0}", saveSensor.SavedFile));
        }
Example #4
0
        public void SaveWithFilePathShouldSaveData()
        {
            TestStorage  saveSensor = new TestStorage();
            TaskListFile file       = new TaskListFile(saveSensor);

            file.Save(new TaskList(), new TestInputParser(new List <string> {
                "TestFileName"
            }));

            Assert.AreEqual("TestFileName", saveSensor.SavedFile, string.Format("Saved file name should be TestFileName, not {0}", saveSensor.SavedFile));
        }