public void EnumerateItems_DiscoversAllCshtmlFiles()
        {
            // Arrange
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var files = fileSystemProject.EnumerateItems("/");

            // Assert
            Assert.Collection(files.OrderBy(f => f.FilePath),
                              file =>
            {
                Assert.Equal("/Home.cshtml", file.FilePath);
                Assert.Equal("/", file.BasePath);
            },
                              file =>
            {
                Assert.Equal("/Views/About/About.cshtml", file.FilePath);
                Assert.Equal("/", file.BasePath);
            },
                              file =>
            {
                Assert.Equal("/Views/Home/Index.cshtml", file.FilePath);
                Assert.Equal("/", file.BasePath);
            });
        }
Ejemplo n.º 2
0
        public void EnumerateItems_DiscoversAllCshtmlFiles()
        {
            // Arrange
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var items = fileSystemProject.EnumerateItems("/");

            // Assert
            Assert.Collection(
                items.OrderBy(f => f.FilePath),
                item =>
            {
                Assert.Equal("/_ViewImports.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "_ViewImports.cshtml"), item.PhysicalPath);
                Assert.Equal("_ViewImports.cshtml", item.RelativePhysicalPath);
            },
                item =>
            {
                Assert.Equal("/Home.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "Home.cshtml"), item.PhysicalPath);
                Assert.Equal("Home.cshtml", item.RelativePhysicalPath);
            },
                item =>
            {
                Assert.Equal("/Views/_ViewImports.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "Views", "_ViewImports.cshtml"), item.PhysicalPath);
                Assert.Equal(Path.Combine("Views", "_ViewImports.cshtml"), item.RelativePhysicalPath);
            },
                item =>
            {
                Assert.Equal("/Views/About/About.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "Views", "About", "About.cshtml"), item.PhysicalPath);
                Assert.Equal(Path.Combine("Views", "About", "About.cshtml"), item.RelativePhysicalPath);
            },
                item =>
            {
                Assert.Equal("/Views/Home/_ViewImports.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "_ViewImports.cshtml"), item.PhysicalPath);
                Assert.Equal(Path.Combine("Views", "Home", "_ViewImports.cshtml"), item.RelativePhysicalPath);
            },
                item =>
            {
                Assert.Equal("/Views/Home/Index.cshtml", item.FilePath);
                Assert.Equal("/", item.BasePath);
                Assert.Equal(Path.Combine(TestFolder, "Views", "Home", "Index.cshtml"), item.PhysicalPath);
                Assert.Equal(Path.Combine("Views", "Home", "Index.cshtml"), item.RelativePhysicalPath);
            });
        }
Ejemplo n.º 3
0
        public void EnumerateItems_ReturnsEmptySequence_WhenBasePathDoesNotExist()
        {
            // Arrange
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var items = fileSystemProject.EnumerateItems("/Does-Not-Exist");

            // Assert
            Assert.Empty(items);
        }