Exemplo n.º 1
0
        public void UpdateOfIgnoredDocument()
        {
            var underTest = new IgnoredEntitiesCollection();
            var oldEntry  = Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == "old path");
            var newEntry  = Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath);

            underTest.Add(oldEntry);
            underTest.Add(newEntry);
            Assert.That(underTest.IsIgnored(Mock.Of <IDocument>(f => f.Id == this.objectId)), Is.EqualTo(IgnoredState.IGNORED));
        }
Exemplo n.º 2
0
        public void DoNotIgnorePathsWithSameBeginningButDifferentEndings()
        {
            var underTest = new IgnoredEntitiesCollection();

            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnoredPath(this.localPath + "bla"), Is.EqualTo(IgnoredState.NOT_IGNORED));
        }
Exemplo n.º 3
0
        public void IgnoreInheritedCheckOnLocalPath()
        {
            var underTest = new IgnoredEntitiesCollection();

            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnoredPath(Path.Combine(this.localPath, Guid.NewGuid().ToString())), Is.EqualTo(IgnoredState.INHERITED));
        }
Exemplo n.º 4
0
        public void IgnoreCheckOnLocalPath()
        {
            var underTest = new IgnoredEntitiesCollection();

            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnoredPath(this.localPath), Is.EqualTo(IgnoredState.IGNORED));
        }
Exemplo n.º 5
0
        public void RemoveElement()
        {
            var underTest = new IgnoredEntitiesCollection();

            Assert.That(underTest.IsIgnoredId(this.objectId), Is.EqualTo(IgnoredState.NOT_IGNORED));

            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));
            underTest.Remove(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnoredId(this.objectId), Is.EqualTo(IgnoredState.NOT_IGNORED));
        }
Exemplo n.º 6
0
        public void IgnoreCheckOfSubDocumentWithoutParent()
        {
            var underTest = new IgnoredEntitiesCollection();
            var doc       = new Mock <IDocument>();

            doc.Setup(f => f.Id).Returns(Guid.NewGuid().ToString());
            var parents = new List <IFolder>();

            doc.Setup(f => f.Parents).Returns(parents);
            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnored(doc.Object), Is.EqualTo(IgnoredState.NOT_IGNORED));
        }
Exemplo n.º 7
0
        public void IgnoreCheckOfSubFolder()
        {
            var underTest = new IgnoredEntitiesCollection();
            var folder    = new Mock <IFolder>();

            folder.Setup(f => f.Id).Returns(Guid.NewGuid().ToString());
            var parent = Mock.Of <IFolder>(f => f.Id == this.objectId);

            folder.Setup(f => f.FolderParent).Returns(parent);
            underTest.Add(Mock.Of <IIgnoredEntity>(o => o.ObjectId == this.objectId && o.LocalPath == this.localPath));

            Assert.That(underTest.IsIgnored(folder.Object), Is.EqualTo(IgnoredState.INHERITED));
        }