コード例 #1
0
        public void GetItem_ReturnsNotFoundResult()
        {
            // Arrange
            var path = "/NotFound.cshtml";
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var item = fileSystemProject.GetItem(path);

            // Assert
            Assert.False(item.Exists);
        }
コード例 #2
0
        public void GetItem_ReturnsFileFromDisk()
        {
            // Arrange
            var path = "/Views/About/About.cshtml";
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var file = fileSystemProject.GetItem(path);

            // Assert
            Assert.True(file.Exists);
            Assert.Equal(path, file.FilePath);
        }
コード例 #3
0
        public void GetItem_ReturnsFileFromDisk()
        {
            // Arrange
            var filePath          = "/Views/About/About.cshtml";
            var fileSystemProject = new FileSystemRazorProject(TestFolder);

            // Act
            var item = fileSystemProject.GetItem(filePath);

            // Assert
            Assert.True(item.Exists);
            Assert.Equal(filePath, 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);
        }