public void AddProject(string name, MockProjectModel project)
        {
            if (projects == null)
                projects = new Dictionary<string, MockProjectModel>();

            projects.Add(name, project);
        }
        public void AddProject(string name, MockProjectModel project)
        {
            if (projects == null)
            {
                projects = new Dictionary <string, MockProjectModel>();
            }

            projects.Add(name, project);
        }
        private void CreateMockSolutionModel()
        {
            MockProjectModel moduleProject1 = new MockProjectModel();
            moduleProject1.Responsibilities = new string[] { "IsModuleProject" };
            moduleProject1.Project = new object();
            moduleProject1.AssemblyName = "Module1";
            moduleProject1.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite\Module1")).FullName;
            MockProjectModel moduleProject2 = new MockProjectModel();
            moduleProject2.Responsibilities = new string[] { "IsModuleProject" };
            moduleProject2.Project = new object();
            moduleProject2.AssemblyName = "Module2";
            moduleProject2.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite\Module2")).FullName;
            MockProjectModel moduleProject3 = new MockProjectModel();
            moduleProject3.Responsibilities = new string[] { "IsModuleProject" };
            moduleProject3.Project = new object();
            moduleProject3.AssemblyName = "Module3";
            moduleProject3.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite\Module1\Module3")).FullName;

            MockProjectModel rootModuleProject = new MockProjectModel();
            rootModuleProject.Responsibilities = new string[] { "IsModuleProject" };
            rootModuleProject.Project = new object();
            rootModuleProject.AssemblyName = "Shell";
            rootModuleProject.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite\Shell")).FullName;
            MockProjectModel foundationalProject = new MockProjectModel();
            foundationalProject.Responsibilities = new string[] { "IsModuleProject" };
            foundationalProject.Project = new object();
            foundationalProject.AssemblyName = "Foundational1";
            foundationalProject.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite\Foundational1")).FullName;
            MockProjectModel webSiteProject1 = new MockProjectModel();
            webSiteProject1.Responsibilities = new string[] { "IsWebProject" };
            webSiteProject1.Project = new object();
            webSiteProject1.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebsite")).FullName;
            MockProjectModel webSiteProject2 = new MockProjectModel();
            webSiteProject2.Project = new object();
            webSiteProject2.ProjectPath = (new System.IO.DirectoryInfo(@".\MockWebSiteProject2")).FullName;
            MockProjectModel otherProject = new MockProjectModel();
            otherProject.Project = new object();
            otherProject.ProjectPath = (new System.IO.DirectoryInfo(@".\OtherProject")).FullName;

            solutionModel.AddProject("Module1", moduleProject1);
            solutionModel.AddProject("Module2", moduleProject2);
            solutionModel.AddProject("Module3", moduleProject3);
            solutionModel.AddProject("Shell", rootModuleProject);
            solutionModel.AddProject("Foundational1", foundationalProject);
            solutionModel.AddProject("WcsfWebSite", webSiteProject1);
            solutionModel.AddProject("SomeWebService", webSiteProject2);
            solutionModel.AddProject("SomeLibrary", otherProject);
        }
        public void WebProjectOnModelIsUpdatedWhenViewSelectsProject()
        {
            MockProjectModel project1 = new MockProjectModel();
            project1.Responsibilities = new string[] { "IsWebProject" };
            project1.Project = new object();
            MockProjectModel project2 = new MockProjectModel();

            solutionModel.AddProject("WebSite1", project1);
            solutionModel.AddProject("SomeLibrary", project2);

            view.FireWebProjectSelected(project1);

            Assert.AreSame(view.SelectedWebProject, project1);
            Assert.IsNotNull(model.WebProject);
        }
        public void SetUp()
        {
            dictionary = new MockDictionaryService();
            view = new MockCreateModulePage();
            solutionModel = new MockSolutionModel(null);
            model = new CreateModulePageModel(dictionary, solutionModel, null);
            presenter = new CreateModulePagePresenter(view, model);

            MockProjectModel moduleProject1 = new MockProjectModel();
            moduleProject1.ProjectPath = (new System.IO.DirectoryInfo(@".\Support\MockWebSite")).FullName;
            dictionary.SetValue("WebUIProject", moduleProject1);
        }
        public void OnViewReadyShowWebProjectsOnly()
        {
            MockProjectModel project1 = new MockProjectModel();
            project1.Responsibilities = new string[] { "IsWebProject" };
            MockProjectModel project2 = new MockProjectModel();

            model.SelectedSolutionFolder = new MockProjectModel();

            solutionModel.AddProject("WebSite1", project1);
            solutionModel.AddProject("SomeLibrary", project2);

            presenter.OnViewReady();

            Assert.AreEqual(view.WebProjectsShown, 1);
        }
        public void OnViewReadyDontShowWebSubProjects()
        {
            //model.IsWCSFSolutionWAP = true;

            MockProjectModel project1 = new MockProjectModel();
            project1.Responsibilities = new string[] { "IsWebProject" };
            MockProjectModel project2 = new MockProjectModel();
            project2.Responsibilities = new string[] { "IsWebProject", "IsFolderOfRootWebProject" };

            model.SelectedSolutionFolder = new MockProjectModel();

            solutionModel.AddProject("WebSite1", project1);
            solutionModel.AddProject("Module1SubWebsite", project2);

            presenter.OnViewReady();

            Assert.AreEqual(view.WebProjectsShown, 1);
        }
        public void ModelIsValidByDefaultOnViewReady()
        {
            MockProjectModel project1 = new MockProjectModel();
            project1.Responsibilities = new string[] { "IsWebProject" };
            project1.Project = new object();
            MockProjectModel project2 = new MockProjectModel();
            MockProjectModel solutionFolder = new MockProjectModel();
            solutionFolder.Name = "Modules";
            model.SelectedSolutionFolder = solutionFolder;

            solutionModel.AddProject("WebSite1", project1);
            solutionModel.AddProject("Modules", solutionFolder);
            solutionModel.AddProject("SomeLibrary", project2);

            dictionary.SetValue("ModuleName", "MyModule");
            dictionary.SetValue("WebUIProject", project1.Project);
            dictionary.SetValue("RecipeLanguage", "cs");

            presenter.OnViewReady();

            Assert.IsTrue(model.IsValid);
        }