public void ConstructFolderTreeByRemoteFolderWithFiles()
        {
            var root = new Mock <IFolder>();
            var a    = Mock.Of <IFolder>(dir => dir.Name == "A");
            var b    = Mock.Of <IFolder>(dir => dir.Name == "B");
            var c    = Mock.Of <IFolder>(dir => dir.Name == "C");
            var d    = Mock.Of <IDocument>(doc => doc.Name == "D");
            var e    = Mock.Of <IFolder>(dir => dir.Name == "E");
            var f    = Mock.Of <IDocument>(doc => doc.Name == "F");
            var g    = Mock.Of <IFolder>(dir => dir.Name == "G");

            Mock.Get(a).SetupChildren(e);
            Mock.Get(b).SetupChildren();
            Mock.Get(c).SetupChildren(d);
            Mock.Get(e).SetupChildren(f, g);
            Mock.Get(g).SetupChildren();
            root.SetupChildren(a, c, b);
            string tree      = @".
├── A
│   └── E
│       ├── F {""file"":true}
│       └── G
├── B
└── C
    └── D {""file"":true}
";
            var    underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(tree)));
        }
        public void ConstructFolderTreeByRemoteFolder()
        {
            var root         = new Mock <IFolder>();
            var remoteRootId = Guid.NewGuid().ToString();

            root.Setup(r => r.Id).Returns(remoteRootId);
            var a = Mock.Of <IFolder>(dir => dir.Name == "A" && dir.Id == "1");
            var b = Mock.Of <IFolder>(dir => dir.Name == "B" && dir.Id == "2");
            var c = Mock.Of <IFolder>(dir => dir.Name == "C" && dir.Id == "3");
            var d = Mock.Of <IFolder>(dir => dir.Name == "D" && dir.Id == "4");
            var e = Mock.Of <IFolder>(dir => dir.Name == "E" && dir.Id == "5");
            var f = Mock.Of <IFolder>(dir => dir.Name == "F" && dir.Id == "6");
            var g = Mock.Of <IFolder>(dir => dir.Name == "G" && dir.Id == "7");

            Mock.Get(a).SetupChildren(e);
            Mock.Get(b).SetupChildren();
            Mock.Get(c).SetupChildren(d);
            Mock.Get(d).SetupChildren();
            Mock.Get(e).SetupChildren(f, g);
            Mock.Get(f).SetupChildren();
            Mock.Get(g).SetupChildren();
            root.SetupChildren(a, c, b);

            var underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
        public void DifferentOrderingsWillProduceEqualOutput() {
            string treeReorderd = @".
├── B
├── A
│   └── E
│       ├── G
│       └── F
└── C
    └── D
";
            var underTest = new FolderTree(treeReorderd);

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
        public void AddLocalAndRemoteIdToFileName()
        {
            string localId     = Guid.NewGuid().ToString();
            string remoteId    = Guid.NewGuid().ToString();
            string name        = "A";
            string nameWithIds = name + " {\"lid\": \"" + localId + "\", \"rid\": \"" + remoteId + "\"}";
            var    underTest   = new FolderTree(nameWithIds);

            Assert.That(underTest.Name, Is.EqualTo(name));
            Assert.That(underTest.LocalId, Is.EqualTo(localId));
            Assert.That(underTest.RemoteId, Is.EqualTo(remoteId));
            Assert.That(underTest, Is.EqualTo(new FolderTree(underTest.ToString())));
            Assert.That(underTest.ToString(), Is.StringContaining(localId).And.StringContaining(remoteId));
        }
        public void NotEqualTrees()
        {
            string differentTree = @".
├── A
│   └── K
│       ├── F
│       └── G
├── B
└── C
    └── D
";
            var    underTest     = new FolderTree(this.tree);

            Assert.That(underTest, Is.Not.EqualTo(new FolderTree(differentTree)));
        }
        public void DifferentOrderingsWillProduceEqualOutput()
        {
            string treeReorderd = @".
├── B
├── A
│   └── E
│       ├── G
│       └── F
└── C
    └── D
";
            var    underTest    = new FolderTree(treeReorderd);

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
        public void EqualTrees()
        {
            string tree = @".
├── A
│   └── E
│       ├── F
│       └── G
├── B
└── C
    └── D
";

            Assert.That(new FolderTree(tree), Is.EqualTo(new FolderTree(tree)));
            var underTest = new FolderTree(tree).ToString();

            Assert.That(underTest, Is.EqualTo(new FolderTree(tree)));
        }
        public void ConstructFolderTreeByLocalDirectory()
        {
            var root = new Mock <IDirectoryInfo>();
            var a    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "A");
            var b    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "B");
            var c    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "C");
            var d    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "D");
            var e    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "E");
            var f    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "F");
            var g    = Mock.Of <IDirectoryInfo>(dir => dir.Name == "G");

            Mock.Get(c).SetupDirectories(d);
            Mock.Get(e).SetupDirectories(f, g);
            Mock.Get(a).SetupDirectories(e);
            root.SetupDirectories(a, c, b);

            var underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
        public void NotEqualTrees() {
            string differentTree = @".
├── A
│   └── K
│       ├── F
│       └── G
├── B
└── C
    └── D
";
            var underTest = new FolderTree(this.tree);

            Assert.That(underTest, Is.Not.EqualTo(new FolderTree(differentTree)));
        }
        public void ConstructFolderTreeByRemoteFolderWithFiles() {
            var root = new Mock<IFolder>();
            var a = Mock.Of<IFolder>(dir => dir.Name == "A");
            var b = Mock.Of<IFolder>(dir => dir.Name == "B");
            var c = Mock.Of<IFolder>(dir => dir.Name == "C");
            var d = Mock.Of<IDocument>(doc => doc.Name == "D");
            var e = Mock.Of<IFolder>(dir => dir.Name == "E");
            var f = Mock.Of<IDocument>(doc => doc.Name == "F");
            var g = Mock.Of<IFolder>(dir => dir.Name == "G");
            Mock.Get(a).SetupChildren(e);
            Mock.Get(b).SetupChildren();
            Mock.Get(c).SetupChildren(d);
            Mock.Get(e).SetupChildren(f, g);
            Mock.Get(g).SetupChildren();
            root.SetupChildren(a, c, b);
            string tree = @".
├── A
│   └── E
│       ├── F {""file"":true}
│       └── G
├── B
└── C
    └── D {""file"":true}
";
            var underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(tree)));
        }
        public void ConvertTreeToString()
        {
            string newTree = new FolderTree(this.tree);

            Assert.That(newTree, Is.EqualTo(this.tree));
        }
        public void ConstructFolderTreeByString()
        {
            var underTest = new FolderTree(this.tree);

            Assert.That(underTest.ToString(), Is.EqualTo(this.tree));
        }
        public void AddLocalAndRemoteIdToFileName() {
            string localId = Guid.NewGuid().ToString();
            string remoteId = Guid.NewGuid().ToString();
            string name = "A";
            string nameWithIds = name + " {\"lid\": \"" + localId + "\", \"rid\": \"" + remoteId + "\"}";
            var underTest = new FolderTree(nameWithIds);

            Assert.That(underTest.Name, Is.EqualTo(name));
            Assert.That(underTest.LocalId, Is.EqualTo(localId));
            Assert.That(underTest.RemoteId, Is.EqualTo(remoteId));
            Assert.That(underTest, Is.EqualTo(new FolderTree(underTest.ToString())));
            Assert.That(underTest.ToString(), Is.StringContaining(localId).And.StringContaining(remoteId));
        }
        public void ConvertStringToTree()
        {
            FolderTree underTest = this.tree;

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
 public void ConvertTreeToString() {
     string newTree = new FolderTree(this.tree);
     Assert.That(newTree, Is.EqualTo(this.tree));
 }
        public void ConstructFolderTreeByString()
        {
            var underTest = new FolderTree(this.tree);

            Assert.That(underTest.ToString(), Is.EqualTo(this.tree));
        }
        public void ConstructFolderTreeByLocalDirectory() {
            var root = new Mock<IDirectoryInfo>();
            var a = Mock.Of<IDirectoryInfo>(dir => dir.Name == "A");
            var b = Mock.Of<IDirectoryInfo>(dir => dir.Name == "B");
            var c = Mock.Of<IDirectoryInfo>(dir => dir.Name == "C");
            var d = Mock.Of<IDirectoryInfo>(dir => dir.Name == "D");
            var e = Mock.Of<IDirectoryInfo>(dir => dir.Name == "E");
            var f = Mock.Of<IDirectoryInfo>(dir => dir.Name == "F");
            var g = Mock.Of<IDirectoryInfo>(dir => dir.Name == "G");
            Mock.Get(c).SetupDirectories(d);
            Mock.Get(e).SetupDirectories(f, g);
            Mock.Get(a).SetupDirectories(e);
            root.SetupDirectories(a, c, b);

            var underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }
        public void EqualTrees() {
            string tree = @".
├── A
│   └── E
│       ├── F
│       └── G
├── B
└── C
    └── D
";
            Assert.That(new FolderTree(tree), Is.EqualTo(new FolderTree(tree)));
            var underTest = new FolderTree(tree).ToString();

            Assert.That(underTest, Is.EqualTo(new FolderTree(tree)));
        }
        public void ConstructFolderTreeByRemoteFolder() {
            var root = new Mock<IFolder>();
            var remoteRootId = Guid.NewGuid().ToString();
            root.Setup(r => r.Id).Returns(remoteRootId);
            var a = Mock.Of<IFolder>(dir => dir.Name == "A" && dir.Id == "1");
            var b = Mock.Of<IFolder>(dir => dir.Name == "B" && dir.Id == "2");
            var c = Mock.Of<IFolder>(dir => dir.Name == "C" && dir.Id == "3");
            var d = Mock.Of<IFolder>(dir => dir.Name == "D" && dir.Id == "4");
            var e = Mock.Of<IFolder>(dir => dir.Name == "E" && dir.Id == "5");
            var f = Mock.Of<IFolder>(dir => dir.Name == "F" && dir.Id == "6");
            var g = Mock.Of<IFolder>(dir => dir.Name == "G" && dir.Id == "7");
            Mock.Get(a).SetupChildren(e);
            Mock.Get(b).SetupChildren();
            Mock.Get(c).SetupChildren(d);
            Mock.Get(d).SetupChildren();
            Mock.Get(e).SetupChildren(f, g);
            Mock.Get(f).SetupChildren();
            Mock.Get(g).SetupChildren();
            root.SetupChildren(a, c, b);

            var underTest = new FolderTree(root.Object, ".");

            Assert.That(underTest, Is.EqualTo(new FolderTree(this.tree)));
        }