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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }