Example #1
0
    public void GetDirectoryContents_CanEnumerateExistingFolders()
    {
        // Arrange
        var assembly = new TestAssembly(
            TestEntry.Directory("unused",
                                TestEntry.Directory("wwwroot",
                                                    TestEntry.File("jquery.validate.js"),
                                                    TestEntry.File("jquery.min.js"),
                                                    TestEntry.File("site.css"))));

        var provider = new ManifestEmbeddedFileProvider(assembly);

        var expectedContents = new[]
        {
            CreateTestFileInfo("jquery.validate.js"),
            CreateTestFileInfo("jquery.min.js"),
            CreateTestFileInfo("site.css")
        };

        // Act
        var contents = provider.GetDirectoryContents("wwwroot").ToArray();

        // Assert
        Assert.Equal(expectedContents, contents, FileInfoComparer.Instance);
    }
        public IEnumerable <(string Name, string Query)> GetProjectionDefinitions()
        {
            var files = _provider.GetDirectoryContents("EventStore/ProjectionDefinitions");

            foreach (var file in files)
            {
                using var streamReader = new StreamReader(file.CreateReadStream());
                yield return(Path.GetFileNameWithoutExtension(file.Name), streamReader.ReadToEnd());
            }
        }
Example #3
0
    public void GetDirectoryContents_ReturnsNoEntries_ForFilePaths()
    {
        // Arrange
        var assembly = new TestAssembly(
            TestEntry.Directory("unused",
                                TestEntry.Directory("wwwroot"),
                                TestEntry.File("site.css")));

        var provider = new ManifestEmbeddedFileProvider(assembly);

        // Act
        var contents = provider.GetDirectoryContents("site.css");

        // Assert
        Assert.IsType <NotFoundDirectoryContents>(contents);
    }
Example #4
0
    public void GetDirectoryContents_ReturnsNotFoundDirectoryContents_ForPathsWithInvalidCharacters(string path)
    {
        // Arrange
        var assembly = new TestAssembly(
            TestEntry.Directory("unused",
                                TestEntry.Directory("wwwroot",
                                                    TestEntry.File("jquery.validate.js"),
                                                    TestEntry.File("jquery.min.js"),
                                                    TestEntry.File("site.css"))));

        // Act
        var provider = new ManifestEmbeddedFileProvider(assembly);

        // Assert
        var directory = provider.GetDirectoryContents(path);

        Assert.IsType <NotFoundDirectoryContents>(directory);
    }
Example #5
0
    public void GetDirectoryContents_EnumeratesFilesAndDirectoriesOnAGivenPath()
    {
        // Arrange
        var assembly = new TestAssembly(
            TestEntry.Directory("unused",
                                TestEntry.Directory("wwwroot"),
                                TestEntry.File("site.css")));

        var provider = new ManifestEmbeddedFileProvider(assembly);

        var expectedContents = new[]
        {
            CreateTestFileInfo("wwwroot", isDirectory: true),
            CreateTestFileInfo("site.css")
        };

        // Act
        var contents = provider.GetDirectoryContents(".").ToArray();

        // Assert
        Assert.Equal(expectedContents, contents, FileInfoComparer.Instance);
    }
        public IDirectoryContents GetDirectoryContents(string subpath)
        {
            var result = _provider.GetDirectoryContents(_assemblyPath + subpath);

            return(result);
        }
        public void GetDirectoryContents_StaticContent_DirFound()
        {
            var dir = _provider.GetDirectoryContents("StaticContent");

            Assert.True(dir.Exists);
        }