public void Load_should_restore_last_project_used_if_required_and_no_args_supplied()
        {
            const string projectFile = "test.gallio";
            var          arguments   = new IcarusArguments();

            optionsController.RestorePreviousSettings = true;
            optionsController.Stub(oc => oc.RecentProjects).Return(new MRUList(new List <string>(new[] { projectFile }), 10));
            fileSystem.Stub(fs => fs.FileExists(projectFile)).Return(true);
            commandFactory.Stub(cf => cf.CreateOpenProjectCommand(projectFile)).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_project_files_from_arguments_should_be_loaded_if_they_exist()
        {
            const string projectFile = "test.gallio";
            var          arguments   = new IcarusArguments {
                Files = new[] { projectFile }
            };

            fileSystem.Stub(fs => fs.FileExists(projectFile)).Return(true);
            commandFactory.Stub(cf => cf.CreateOpenProjectCommand(projectFile)).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_with_no_restore_and_no_args_should_create_new_project()
        {
            const string projectFile = "test.gallio";
            var          arguments   = new IcarusArguments();

            optionsController.RestorePreviousSettings = false;
            optionsController.Stub(oc => oc.RecentProjects).Return(new MRUList(new List <string>(new[] { projectFile }), 10));
            commandFactory.Stub(c => c.CreateNewProjectCommand()).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            Assert.AreEqual(string.Format("Default - {0}", Icarus.Properties.Resources.ApplicationName),
                            applicationController.Title);
            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_files_from_arguments_should_be_added_if_they_exist()
        {
            const string file1 = "test1.dll";
            const string file2 = "test2.dll";
            var          files = new List <string>()
            {
                file1
            };
            var arguments = new IcarusArguments {
                Files = new[] { file1, file2 }
            };

            fileSystem.Stub(fs => fs.FileExists(file1)).Return(true);
            commandFactory.Stub(cf => cf.CreateAddFilesCommand(files)).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_with_no_restore_and_no_args_should_create_new_project()
        {
            const string projectFile = "test.gallio";
            var arguments = new IcarusArguments();
            optionsController.RestorePreviousSettings = false;
            optionsController.Stub(oc => oc.RecentProjects).Return(new MRUList(new List<string>(new[] { projectFile }), 10));
            commandFactory.Stub(c => c.CreateNewProjectCommand()).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            Assert.AreEqual(string.Format("Default - {0}", Icarus.Properties.Resources.ApplicationName),
                            applicationController.Title);
            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_should_restore_last_project_used_if_required_and_no_args_supplied()
        {
            const string projectFile = "test.gallio";
            var arguments = new IcarusArguments();
            optionsController.RestorePreviousSettings = true;
            optionsController.Stub(oc => oc.RecentProjects).Return(new MRUList(new List<string>(new[] { projectFile }), 10));
            fileSystem.Stub(fs => fs.FileExists(projectFile)).Return(true);
            commandFactory.Stub(cf => cf.CreateOpenProjectCommand(projectFile)).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_project_files_from_arguments_should_be_loaded_if_they_exist()
        {
            const string projectFile = "test.gallio";
            var arguments = new IcarusArguments { Files = new[] { projectFile } };
            fileSystem.Stub(fs => fs.FileExists(projectFile)).Return(true);
            commandFactory.Stub(cf => cf.CreateOpenProjectCommand(projectFile)).Return(command);

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }
        public void Load_files_from_arguments_should_be_added_if_they_exist()
        {
            const string file1 = "test1.dll";
            const string file2 = "test2.dll";
            var files = new List<string>() {file1};
            var arguments = new IcarusArguments { Files = new[] { file1, file2 } };
            fileSystem.Stub(fs => fs.FileExists(file1)).Return(true);
            commandFactory.Stub(cf => cf.CreateAddFilesCommand(files)).Return(command);            

            applicationController.Arguments = arguments;
            applicationController.Load();

            taskManager.AssertWasCalled(t => t.QueueTask(command));
        }