public void TestGenerateAllFiles_Folder_Sub_File()
        {
            IFile        staticFile   = mocks.DynamicMock <IFile>();
            IScript      scriptFile   = mocks.DynamicMock <IScript>();
            IFolder      subFolder    = mocks.DynamicMock <IFolder>();
            ProviderInfo providerMock = mocks.DynamicMock <ProviderInfo>();

            using (mocks.Record())
            {
                SetupFolder(subFolder, new IFolder[0], new[] { scriptFile }, new[] { staticFile }, "folder");
                SetupFolder(folder, new[] { subFolder }, new IScript[0], new IFile[0], "");
                SetupProject();
                SetupStaticFile(staticFile);
                SetupScriptFile(scriptFile);
                SetupProvider(providerMock);
                SetupController();
                SetupLoader(scriptFile);
                Expect.Call(() => projectInfo.AddGeneratedFile(new GeneratedFile(
                                                                   "Class.cs", "C:\\Temp\\folder\\Class.cs", "folder\\Class.cs", "Class", "Iterator")));
                Expect.Call(() => projectInfo.AddGeneratedFile(new GeneratedFile(
                                                                   "file.jpg", "C:\\Temp\\folder\\file.jpg", "folder\\file.jpg", "", "Iterator")));
            }

            GenerationHelper helper = new GenerationHelper(progressHelper, loader, projectInfo, fileController);
            ProjectFileTree  tree   = new ProjectFileTree();

            helper.GenerateAllFiles("", folder, tree, scriptObject, "C:\\Temp");

            Assert.That(tree.AllNodes.Count, Is.EqualTo(3));
            ProjectFileTreeNode subfolder = tree.ChildNodes[0];

            Assert.That(subfolder.Status, Is.EqualTo(ProjectFileStatusEnum.Folder));
            Assert.That(subfolder.Text, Is.EqualTo("folder"));
            Assert.That(subfolder.ChildNodes.Count, Is.EqualTo(2));

            ProjectFileTreeNode childNode = subfolder.ChildNodes[0];

            Assert.That(childNode.Status, Is.EqualTo(ProjectFileStatusEnum.UnAnalysedFile));
            Assert.That(childNode.Text, Is.EqualTo("Class.cs"));
            Assert.That(childNode.ChildNodes, Is.Empty);
            Assert.That(childNode.AssociatedFile.RelativeFilePath, Is.EqualTo(Path.Combine("folder", "Class.cs")));
            TextFileInformation tfi = (TextFileInformation)childNode.AssociatedFile;

            Assert.That(tfi.NewGenFile.FilePath,
                        Is.EqualTo(Path.Combine(controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGenerator), childNode.AssociatedFile.RelativeFilePath)),
                        "New Gen file was not assigned to");

            childNode = subfolder.ChildNodes[1];
            Assert.That(childNode.Status, Is.EqualTo(ProjectFileStatusEnum.UnAnalysedFile));
            Assert.That(childNode.Text, Is.EqualTo("file.jpg"));
            Assert.That(childNode.ChildNodes, Is.Empty);
            Assert.That(childNode.AssociatedFile.RelativeFilePath, Is.EqualTo(Path.Combine("folder", "file.jpg")));
            BinaryFileInformation bfi = (BinaryFileInformation)childNode.AssociatedFile;

            Assert.That(bfi.NewGenFile.FilePath,
                        Is.EqualTo(Path.Combine(controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGenerator), childNode.AssociatedFile.RelativeFilePath)),
                        "New Gen file was not assigned to");

            mocks.VerifyAll();
        }
        public void TestAddChildNodeWithAssociatedFile()
        {
            // We don't need this to do anything except be not null.
            IFileInformation fileInformation = MockRepository.GenerateStub <IFileInformation>();

            ProjectFileTree     tree  = new ProjectFileTree();
            ProjectFileTreeNode child = tree.AddChildNode(fileInformation);

            Assert.That(tree.ChildNodes[0].AssociatedFile, Is.SameAs(fileInformation),
                        "The child must be constructed with the supplied AssociatedFile.");
            Assert.That(tree.ChildNodes[0], Is.SameAs(child), "The first ChildNode must be the new child node.");
            Assert.That(tree.AllNodes[0], Is.SameAs(child),
                        "The first node in the AllNodes collection must be the new child.");
        }
        public void TestAddChildNodeWithNullFile()
        {
            ProjectFileTree     tree  = new ProjectFileTree();
            ProjectFileTreeNode child = tree.AddChildNode();

            Assert.That(tree.ChildNodes.Count, Is.EqualTo(1), "The child should have been added to the tree's ChildNodes");
            Assert.That(tree.AllNodes.Count, Is.EqualTo(1), "The child should have been added to the tree's Nodes");
            Assert.That(tree.ChildNodes[0], Is.SameAs(child), "The first ChildNode must be the new child node.");
            Assert.That(tree.AllNodes[0], Is.SameAs(child), "The first node in the AllNodes collection must be the new child.");

            Assert.That(tree.ChildNodes[0].AssociatedFile, Is.Null, "The child must be constructed with a null AssociatedFile.");
            Assert.That(tree.ChildNodes[0].ParentNode, Is.SameAs(tree), "The ParentNode must be the tree.");
            Assert.That(tree.ChildNodes[0].ParentTree, Is.SameAs(tree), "The ParentTree must be the tree.");
            Assert.That(tree.ChildNodes[0].Status, Is.EqualTo(ProjectFileStatusEnum.UnAnalysedFile), "A ProjectFileTreeNode's status must be UnanalysedFile by default.");
        }