public static void AreEqual(MvcProjectFile expected, MvcProjectFile actual)
        {
            string expectedAsString = GetMvcProjectFileAsString(expected);
            string actualAsString   = GetMvcProjectFileAsString(actual);

            Assert.AreEqual(expectedAsString, actualAsString);
        }
		MvcProjectFile CreateProjectFile(string fullPath)
		{
			var projectItem = new FileProjectItem(project, ItemType.Compile);
			projectItem.FileName = FileName.Create(fullPath);
			file = new MvcProjectFile(projectItem);
			return file;
		}
예제 #3
0
        MvcProjectFile CreateProjectFile(string fullPath)
        {
            var projectItem = new FileProjectItem(project, ItemType.Compile);

            projectItem.FileName = FileName.Create(fullPath);
            file = new MvcProjectFile(projectItem);
            return(file);
        }
 public static string GetMvcProjectFileAsString(MvcProjectFile fileName)
 {
     return(String.Format(
                "FileName: {0}\r\nFolder: {1}\r\n, FullPath: {2}",
                fileName.FileName,
                fileName.FolderRelativeToProject,
                fileName.FullPath));
 }
		public static string GetMvcProjectFileAsString(MvcProjectFile fileName)
		{
			return String.Format(
				"FileName: {0}\r\nFolder: {1}\r\n, FullPath: {2}",
				fileName.FileName,
				fileName.FolderRelativeToProject,
				fileName.FullPath);
		}
예제 #6
0
        public void CompareTo_FileNamesAreSameAndSecondFolderIsGreaterThanFirstFolder_ReturnsMinussOne()
        {
            CreateProject(@"d:\projects\MyProject\MyProject.csproj");
            MvcProjectFile lhs = CreateProjectFile(@"d:\projects\MyProject\A\site.Master");
            MvcProjectFile rhs = CreateProjectFile(@"d:\projects\MyProject\Z\site.Master");

            int result = lhs.CompareTo(rhs);

            Assert.AreEqual(-1, result);
        }
예제 #7
0
        public void CompareTo_FoldersAreSameAndSecondFileNameIsLessThanFirstFileName_ReturnsPlusOne()
        {
            CreateProject(@"d:\projects\MyProject\MyProject.csproj");
            MvcProjectFile lhs = CreateProjectFile(@"d:\projects\MyProject\Shared\Z.Master");
            MvcProjectFile rhs = CreateProjectFile(@"d:\projects\MyProject\Shared\A.Master");

            int result = lhs.CompareTo(rhs);

            Assert.AreEqual(1, result);
        }
예제 #8
0
        public void CompareTo_FileNamesAreTheSame_ReturnsZero()
        {
            CreateProject(@"d:\projects\MyProject\MyProject.csproj");
            MvcProjectFile lhs = CreateProjectFile(@"d:\projects\MyProject\Site.Master");
            MvcProjectFile rhs = CreateProjectFile(@"d:\projects\MyProject\Site.Master");

            int result = lhs.CompareTo(rhs);

            Assert.AreEqual(0, result);
        }
예제 #9
0
        public void GetRazorFiles_OneRazorWithFileExtensionInUpperCaseInProject_ReturnsOneRazorFileWithExpectedFileName()
        {
            CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
            AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\TEST.CSHTML");
            MvcProjectFile fileName = GetRazorFiles().First();

            var expectedFileName = new MvcProjectFile()
            {
                FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\TEST.CSHTML",
                FileName = "TEST.CSHTML",
                FolderRelativeToProject = @"Views\Shared"
            };

            MvcProjectFileAssert.AreEqual(expectedFileName, fileName);
        }
예제 #10
0
        public void GetAspxMasterPageFiles_OneMasterPageInProject_ReturnsOneMasterPageWithExpectedFile()
        {
            CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
            AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\Site.Master");
            MvcProjectFile file = GetAspxMasterPageFiles().First();

            var expectedFile = new MvcProjectFile()
            {
                FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\Site.Master",
                FileName = "Site.Master",
                FolderRelativeToProject = @"Views\Shared"
            };

            MvcProjectFileAssert.AreEqual(expectedFile, file);
        }
예제 #11
0
        public void GetRazorFiles_OneRazorFileInProject_ReturnsOneRazorFileWithExpectedFile()
        {
            CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
            AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\_Layout.cshtml");
            MvcProjectFile file = GetRazorFiles().First();

            var expectedFile = new MvcProjectFile()
            {
                FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\_Layout.cshtml",
                FileName = "_Layout.cshtml",
                FolderRelativeToProject = @"Views\Shared"
            };

            MvcProjectFileAssert.AreEqual(expectedFile, file);
        }
예제 #12
0
        public void GetRazorFiles_OneHtmlFileAndOneRazorFileInProject_ReturnsOneRazorFileWithExpectedFileName()
        {
            CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
            AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\test.html");
            AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\test.cshtml");
            List <MvcProjectFile> files = GetRazorFiles();

            var expectedFileName = new MvcProjectFile()
            {
                FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\test.cshtml",
                FileName = "test.cshtml",
                FolderRelativeToProject = @"Views\Shared"
            };

            var expectedFiles = new MvcProjectFile[] {
                expectedFileName
            };

            MvcProjectFileCollectionAssert.AreEqual(expectedFiles, files);
        }
		public void MasterPages_ProjectContainsOneAspxMasterPage_ReturnsOneAspxMasterPage()
		{
			CreateViewModel();
			SelectAspxViewEngine();
			var masterPageFile = new MvcProjectFile() {
				FullPath = @"d:\projects\MyProject\Views\Shared\Site.Master",
				FileName = "Site.Master",
				FolderRelativeToProject = @"Views\Shared"
			};
			fakeProject.AddAspxMasterPageFile(masterPageFile);
			viewModel.OpenSelectMasterPageView();
			
			var expectedFiles = new MvcProjectFile[] {
				masterPageFile
			};
			
			ObservableCollection<MvcProjectFile> files = viewModel.MasterPages;
			
			Assert.AreEqual(expectedFiles, files);
		}
예제 #14
0
		public static void AreEqual(MvcProjectFile expected, MvcProjectFile actual)
		{
			string expectedAsString = GetMvcProjectFileAsString(expected);
			string actualAsString = GetMvcProjectFileAsString(actual);
			Assert.AreEqual(expectedAsString, actualAsString);
		}
        public void CreateMvcProjectMasterPageFile_NullProjectItemPassed_ReturnsNull()
        {
            MvcProjectFile file = MvcProjectMasterPageFile.CreateMvcProjectMasterPageFile(null);

            Assert.IsNull(file);
        }
예제 #16
0
		public void GetAspxMasterPageFiles_OneMasterPageInProject_ReturnsOneMasterPageWithExpectedFile()
		{
			CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
			AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\Site.Master");
			MvcProjectFile file = GetAspxMasterPageFiles().First();
			
			var expectedFile = new MvcProjectFile() {
				FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\Site.Master",
				FileName = "Site.Master",
				FolderRelativeToProject = @"Views\Shared"
			};
			
			MvcProjectFileAssert.AreEqual(expectedFile, file);
		}
예제 #17
0
 public void AddAspxMasterPageFile(MvcProjectFile file)
 {
     AspxMasterPageFiles.Add(file);
 }
예제 #18
0
 public void AddRazorFile(MvcProjectFile file)
 {
     RazorFiles.Add(file);
 }
		public void MasterPages_ProjectContainsTwoRazorPagesInIncorrectSortOrder_ReturnsTwoRazorFilesSorted()
		{
			CreateViewModel();
			SelectRazorViewEngine();
			var razorFile1 = new MvcProjectFile() {
				FullPath = @"d:\projects\MyProject\Views\Shared\ViewSite.cshtml",
				FileName = "ViewSite.cshtml",
				FolderRelativeToProject = @"Views\Shared"
			};
			fakeProject.AddRazorFile(razorFile1);
			var razorFile2 = new MvcProjectFile() {
				FullPath = @"d:\projects\MyProject\Views\Shared\Site.cshtml",
				FileName = "Site.cshtml",
				FolderRelativeToProject = @"Views\Shared"
			};
			fakeProject.AddRazorFile(razorFile2);
			viewModel.OpenSelectMasterPageView();
			
			var expectedFiles = new MvcProjectFile[] {
				razorFile2,
				razorFile1
			};
			
			ObservableCollection<MvcProjectFile> files = viewModel.MasterPages;
			
			Assert.AreEqual(expectedFiles, files);
		}
		public void MasterPages_ProjectContainsOneRazorFileAndRazorEngineSelected_ReturnsOneRazorFile()
		{
			CreateViewModel();
			SelectRazorViewEngine();
			var razorFile = new MvcProjectFile() {
				FullPath = @"d:\projects\MyProject\Views\Shared\_Layout.cshtml",
				FileName = "_Layout.cshtml",
				FolderRelativeToProject = @"Views\Shared"
			};
			fakeProject.AddRazorFile(razorFile);
			viewModel.OpenSelectMasterPageView();
			
			var expectedFiles = new MvcProjectFile[] {
				razorFile
			};
			
			ObservableCollection<MvcProjectFile> files = viewModel.MasterPages;
			
			Assert.AreEqual(expectedFiles, files);
		}
		public void SelectMasterPage_MasterPageSelected_MasterPageFilePropertyChangedEventFired()
		{
			CreateViewModel();
			viewModel.OpenSelectMasterPageView();
			var masterPageFileName = new MvcProjectFile();
			viewModel.SelectedMasterPage = masterPageFileName;
			
			MonitorPropertyChangedEvents();
			viewModel.SelectMasterPage();
			
			bool fired = propertyChangedEvents.Contains("MasterPageFile");
			
			Assert.IsTrue(fired);
		}
		public void SelectMasterPage_MasterPageSelected_MasterPageFileNameUpdated()
		{
			CreateViewModel();
			viewModel.MasterPageFile = "test.master";
			viewModel.OpenSelectMasterPageView();
			var masterPageFileName = new MvcProjectFile() {
				FullPath = @"d:\projects\MyProject\Views\Shared\site.master",
				FileName = "site.master",
				FolderRelativeToProject = @"Views\Shared",
				VirtualPath = "~/Views/Shared/site.master"
			};
			viewModel.SelectedMasterPage = masterPageFileName;
			viewModel.SelectMasterPage();
			
			string updatedMasterPageFile = viewModel.MasterPageFile;
			
			Assert.AreEqual("~/Views/Shared/site.master", updatedMasterPageFile);
		}
예제 #23
0
		public void AddRazorFile(MvcProjectFile file)
		{
			RazorFiles.Add(file);
		}
예제 #24
0
		public void GetRazorFiles_OneRazorWithFileExtensionInUpperCaseInProject_ReturnsOneRazorFileWithExpectedFileName()
		{
			CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
			AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\TEST.CSHTML");
			MvcProjectFile fileName = GetRazorFiles().First();
			
			var expectedFileName = new MvcProjectFile() {
				FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\TEST.CSHTML",
				FileName = "TEST.CSHTML",
				FolderRelativeToProject = @"Views\Shared"
			};
			
			MvcProjectFileAssert.AreEqual(expectedFileName, fileName);
		}
예제 #25
0
		public void GetRazorFiles_OneHtmlFileAndOneRazorFileInProject_ReturnsOneRazorFileWithExpectedFileName()
		{
			CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
			AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\test.html");
			AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\test.cshtml");
			List<MvcProjectFile> files = GetRazorFiles();
			
			var expectedFileName = new MvcProjectFile() {
				FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\test.cshtml",
				FileName = "test.cshtml",
				FolderRelativeToProject = @"Views\Shared"
			};
			
			var expectedFiles = new MvcProjectFile[] {
				expectedFileName
			};
			
			MvcProjectFileCollectionAssert.AreEqual(expectedFiles, files);
		}
예제 #26
0
		public void GetRazorFiles_OneRazorFileInProject_ReturnsOneRazorFileWithExpectedFile()
		{
			CreateProject(@"d:\projects\AspNetMvcProject\MyProject.csproj");
			AddFileToProject(@"d:\projects\AspNetMvcProject\Views\Shared\_Layout.cshtml");
			MvcProjectFile file = GetRazorFiles().First();
			
			var expectedFile = new MvcProjectFile() {
				FullPath = @"d:\projects\AspNetMvcProject\Views\Shared\_Layout.cshtml",
				FileName = "_Layout.cshtml",
				FolderRelativeToProject = @"Views\Shared"
			};
			
			MvcProjectFileAssert.AreEqual(expectedFile, file);
		}
예제 #27
0
		public void AddAspxMasterPageFile(MvcProjectFile file)
		{
			AspxMasterPageFiles.Add(file);
		}
		public void MasterPages_CloseAndReOpenSelectMasterPageViewWhenProjectContainsOneAspxMasterPage_ReturnsOneAspxMasterPage()
		{
			CreateViewModel();
			SelectAspxViewEngine();
			var masterPageFile = new MvcProjectFile();
			fakeProject.AddAspxMasterPageFile(masterPageFile);
			viewModel.OpenSelectMasterPageView();
			viewModel.CloseSelectMasterPageView();
			viewModel.OpenSelectMasterPageView();
			
			var expectedFiles = new MvcProjectFile[] {
				masterPageFile
			};
			
			ObservableCollection<MvcProjectFile> files = viewModel.MasterPages;
			
			Assert.AreEqual(expectedFiles, files);
		}