Ejemplo n.º 1
0
        public void When_DirectoryEmpty_Then_ReturnEmptyCollection()
        {
            using (var helper = new DirectoryHelper())
            {
                IFileProvider      fileProvider      = new PhysicalFileProvider(helper.DirectoryPath);
                IFilesInfoProvider filesInfoProvider = new FilesInfoProvider(fileProvider);

                IEnumerable <IFile> files = filesInfoProvider.GetFiles();

                files.Should().BeEmpty();
            }
        }
Ejemplo n.º 2
0
        public void When_OneFile_IsInDirectory_Then_OneElementCollectionFound()
        {
            using (var helper = new DirectoryHelper())
            {
                helper.CreateFile();

                IFileProvider      fileProvider      = new PhysicalFileProvider(helper.DirectoryPath);
                IFilesInfoProvider filesInfoProvider = new FilesInfoProvider(fileProvider);

                IEnumerable <IFile> files = filesInfoProvider.GetFiles();

                files.Should().HaveCount(1);
            }
        }
Ejemplo n.º 3
0
        public void When_testFileName_IsInDirectory_Then_FileWithName_testFileName_Found()
        {
            string fileName = "testFileName";

            using (var helper = new DirectoryHelper())
            {
                helper.CreateFile(fileName);

                IFileProvider      fileProvider      = new PhysicalFileProvider(helper.DirectoryPath);
                IFilesInfoProvider filesInfoProvider = new FilesInfoProvider(fileProvider);

                IEnumerable <IFile> files = filesInfoProvider.GetFiles();

                files.Single().Name.Should().Be(fileName);
            }
        }
Ejemplo n.º 4
0
        public void When_file_WithGivenKnownExtension_IsInDirectory_Then_FileWithGivenExtensionCutOffFromName_Found(string extension)
        {
            string fileName = "testFileName";

            using (var helper = new DirectoryHelper())
            {
                helper.CreateFile(fileName, extension);

                IFileProvider      fileProvider      = new PhysicalFileProvider(helper.DirectoryPath);
                IFilesInfoProvider filesInfoProvider = new FilesInfoProvider(fileProvider);

                IEnumerable <IFile> files = filesInfoProvider.GetFiles();

                files.Single().Name.Should().Be(fileName);
                files.Single().Extension.Should().Be(extension);
            }
        }