Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Filter.FilterAggregator"/> class.
        /// </summary>
        /// <param name="fileNamesFilter">File names filter.</param>
        /// <param name="folderNamesFilter">Folder names filter.</param>
        /// <param name="invalidFolderNamesFilter">Invalid folder names filter.</param>
        /// <param name="ignoredFolderFilter">Ignored folder filter.</param>
        public FilterAggregator(
            IgnoredFileNamesFilter fileNamesFilter,
            IgnoredFolderNameFilter folderNamesFilter,
            InvalidFolderNameFilter invalidFolderNamesFilter,
            IgnoredFoldersFilter ignoredFolderFilter,
            SymlinkFilter symlinkFilter = null)
        {
            if (fileNamesFilter == null)
            {
                throw new ArgumentNullException("fileNamesFilter");
            }

            if (folderNamesFilter == null)
            {
                throw new ArgumentNullException("folderNamesFilter");
            }

            if (invalidFolderNamesFilter == null)
            {
                throw new ArgumentNullException("invalidFolderNamesFilter");
            }

            if (ignoredFolderFilter == null)
            {
                throw new ArgumentNullException("ignoredFolderFilter");
            }

            this.FileNamesFilter          = fileNamesFilter;
            this.FolderNamesFilter        = folderNamesFilter;
            this.InvalidFolderNamesFilter = invalidFolderNamesFilter;
            this.IgnoredFolderFilter      = ignoredFolderFilter;
            this.SymlinkFilter            = symlinkFilter ?? new SymlinkFilter();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportingFilter"/> class.
        /// </summary>
        /// <param name="queue">Sync Event Queue to put work on.</param>
        /// <param name="ignoredFoldersFilter">Ignored folders filter.</param>
        /// <param name="ignoredFileNameFilter">Ignored file name filter.</param>
        /// <param name="ignoredFolderNameFilter">Ignored folder name filter.</param>
        /// <param name="invalidFoderNameFilter">Invalid folder name filter</param> 
        public ReportingFilter(
            ISyncEventQueue queue,
            IgnoredFoldersFilter ignoredFoldersFilter,
            IgnoredFileNamesFilter ignoredFileNameFilter,
            IgnoredFolderNameFilter ignoredFolderNameFilter,
            InvalidFolderNameFilter invalidFoderNameFilter,
            SymlinkFilter symlinkFilter) : base(queue)
        {
            if (ignoredFoldersFilter == null) {
                throw new ArgumentNullException("ignoredFoldersFilter");
            }

            if (ignoredFileNameFilter == null) {
                throw new ArgumentNullException("ignoredFileNameFilter");
            }

            if (ignoredFolderNameFilter == null) {
                throw new ArgumentNullException("ignoredFolderNameFilter");
            }

            if (invalidFoderNameFilter == null) {
                throw new ArgumentNullException("invalidFoderNameFilter");
            }

            if (symlinkFilter == null) {
                throw new ArgumentNullException("symlinkFilter");
            }

            this.ignoredFoldersFilter = ignoredFoldersFilter;
            this.ignoredFileNameFilter = ignoredFileNameFilter;
            this.ignoredFolderNameFilter = ignoredFolderNameFilter;
            this.invalidFolderNameFilter = invalidFoderNameFilter;
            this.symlinkFilter = symlinkFilter;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.Filter.FilterAggregator"/> class.
        /// </summary>
        /// <param name="fileNamesFilter">File names filter.</param>
        /// <param name="folderNamesFilter">Folder names filter.</param>
        /// <param name="invalidFolderNamesFilter">Invalid folder names filter.</param>
        /// <param name="ignoredFolderFilter">Ignored folder filter.</param>
        public FilterAggregator(
            IgnoredFileNamesFilter fileNamesFilter,
            IgnoredFolderNameFilter folderNamesFilter,
            InvalidFolderNameFilter invalidFolderNamesFilter,
            IgnoredFoldersFilter ignoredFolderFilter,
            SymlinkFilter symlinkFilter = null)
        {
            if (fileNamesFilter == null) {
                throw new ArgumentNullException("fileNamesFilter");
            }

            if (folderNamesFilter == null) {
                throw new ArgumentNullException("folderNamesFilter");
            }

            if (invalidFolderNamesFilter == null) {
                throw new ArgumentNullException("invalidFolderNamesFilter");
            }

            if (ignoredFolderFilter == null) {
                throw new ArgumentNullException("ignoredFolderFilter");
            }

            this.FileNamesFilter = fileNamesFilter;
            this.FolderNamesFilter = folderNamesFilter;
            this.InvalidFolderNamesFilter = invalidFolderNamesFilter;
            this.IgnoredFolderFilter = ignoredFolderFilter;
            this.SymlinkFilter = symlinkFilter ?? new SymlinkFilter();
        }
Exemplo n.º 4
0
 public void SetUpFilter() {
     this.ignoreFoldersFilter = Mock.Of<IgnoredFoldersFilter>();
     this.ignoreFileNamesFilter = Mock.Of<IgnoredFileNamesFilter>();
     this.ignoreFolderNamesFilter = Mock.Of<IgnoredFolderNameFilter>();
     this.invalidFolderNameFilter = Mock.Of<InvalidFolderNameFilter>();
     this.symlinkFilter = Mock.Of<SymlinkFilter>();
     this.queue = new Mock<ISyncEventQueue>();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportingFilter"/> class.
        /// </summary>
        /// <param name="queue">Sync Event Queue to put work on.</param>
        /// <param name="ignoredFoldersFilter">Ignored folders filter.</param>
        /// <param name="ignoredFileNameFilter">Ignored file name filter.</param>
        /// <param name="ignoredFolderNameFilter">Ignored folder name filter.</param>
        /// <param name="invalidFoderNameFilter">Invalid folder name filter</param>
        public ReportingFilter(
            ISyncEventQueue queue,
            IgnoredFoldersFilter ignoredFoldersFilter,
            IgnoredFileNamesFilter ignoredFileNameFilter,
            IgnoredFolderNameFilter ignoredFolderNameFilter,
            InvalidFolderNameFilter invalidFoderNameFilter,
            SymlinkFilter symlinkFilter) : base(queue)
        {
            if (ignoredFoldersFilter == null)
            {
                throw new ArgumentNullException("ignoredFoldersFilter");
            }

            if (ignoredFileNameFilter == null)
            {
                throw new ArgumentNullException("ignoredFileNameFilter");
            }

            if (ignoredFolderNameFilter == null)
            {
                throw new ArgumentNullException("ignoredFolderNameFilter");
            }

            if (invalidFoderNameFilter == null)
            {
                throw new ArgumentNullException("invalidFoderNameFilter");
            }

            if (symlinkFilter == null)
            {
                throw new ArgumentNullException("symlinkFilter");
            }

            this.ignoredFoldersFilter    = ignoredFoldersFilter;
            this.ignoredFileNameFilter   = ignoredFileNameFilter;
            this.ignoredFolderNameFilter = ignoredFolderNameFilter;
            this.invalidFolderNameFilter = invalidFoderNameFilter;
            this.symlinkFilter           = symlinkFilter;
        }
Exemplo n.º 6
0
        public void DetectSymlinksCorrectly([Values(true, false)]bool exists, [Values(true, false)]bool isSymlink) {
            var underTest = new SymlinkFilter();
            string path = "path";
            string reason;
            var fileInfo = new Mock<IFileSystemInfo>(MockBehavior.Strict);
            fileInfo.Setup(f => f.Exists).Returns(exists);
            fileInfo.Setup(f => f.IsSymlink).Returns(isSymlink);
            fileInfo.Setup(f => f.FullName).Returns(path);
            var result = underTest.IsSymlink(fileInfo.Object, out reason);
            Assert.That(result, Is.EqualTo(exists && isSymlink));
            Assert.That(reason, Is.Not.Null);
            if (result) {
                Assert.That(reason, Is.StringContaining(path));
                fileInfo.Verify(f => f.FullName, Times.Once());
            } else {
                Assert.That(reason, Is.EqualTo(string.Empty));
                fileInfo.Verify(f => f.FullName, Times.Never());
            }

            fileInfo.Verify(f => f.Exists, Times.AtMostOnce());
            fileInfo.Verify(f => f.IsSymlink, Times.AtMostOnce());
        }