public void ToLinePrintReturnsOneLinePerNotFittingEntry() { var storage = new MetaDataStorage(this.engine, Mock.Of<IPathMatcher>(), false); var rootFolder = new MappedObject("name", "rootId", MappedObjectType.Folder, null, "token"); var child1Folder = new MappedObject("sub1", "subId1", MappedObjectType.Folder, "WRONGID", "token"); storage.SaveMappedObject(rootFolder); storage.SaveMappedObject(child1Folder); string src = storage.ToFindString(); int count = src.Select((c, i) => src.Substring(i)).Count(sub => sub.StartsWith(Environment.NewLine)); Assert.That(count, Is.EqualTo(2), string.Format("Newlines Counting {0}:{2} {1}", count, src, Environment.NewLine)); }
public void ToLinePrintReturnsOneLineIfOnlyRootFolderIsInDB([Values(true, false)]bool withValidation) { var storage = new MetaDataStorage(this.engine, Mock.Of<IPathMatcher>(), withValidation); var rootFolder = new MappedObject("name", "rootId", MappedObjectType.Folder, null, "token"); storage.SaveMappedObject(rootFolder); Assert.That(storage.ToFindString(), Is.EqualTo("name" + Environment.NewLine)); }
public void ToLinePrintReturnsOneLinePerEntry([Values(true, false)]bool withValidation) { var storage = new MetaDataStorage(this.engine, Mock.Of<IPathMatcher>(), withValidation); var rootFolder = new MappedObject("name", "rootId", MappedObjectType.Folder, null, "token"); var child1Folder = new MappedObject("sub1", "subId1", MappedObjectType.Folder, "rootId", "token"); var child2Folder = new MappedObject("sub2", "subId2", MappedObjectType.Folder, "rootId", "token"); var child3Folder = new MappedObject("sub3", "subId3", MappedObjectType.Folder, "rootId", "token"); var subChildFile = new MappedObject("file", "subId4", MappedObjectType.File, "subId1", "token"); storage.SaveMappedObject(rootFolder); storage.SaveMappedObject(child1Folder); storage.SaveMappedObject(child2Folder); storage.SaveMappedObject(child3Folder); storage.SaveMappedObject(subChildFile); string src = storage.ToFindString(); int count = src.Select((c, i) => src.Substring(i)).Count(sub => sub.StartsWith(Environment.NewLine)); Assert.That(count, Is.EqualTo(5), string.Format("Newlines Counting {0}:{2} {1}", count, src, Environment.NewLine)); }
public void ToLinePrintReturnsEmptyStringOnEmptyDB([Values(true, false)]bool withValidation) { var storage = new MetaDataStorage(this.engine, Mock.Of<IPathMatcher>(), withValidation); Assert.That(storage.ToFindString(), Is.EqualTo(string.Empty)); }