Ejemplo n.º 1
0
        public void BasicRun()
        {
            AnalysisProgressHelperStub helperStub = new AnalysisProgressHelperStub();

            AnalysisHelper ah = new AnalysisHelper();
            ah.StartAnalysis(helperStub, controller, new ProjectFileTree());

            Assert.That(helperStub.Count, Is.EqualTo(0));
            Assert.That(helperStub.LastProgressObjectList.Count, Is.EqualTo(2));

            AnalyseFilesProgress progress = (AnalyseFilesProgress)helperStub.LastProgressObjectList[1];
            Assert.That(progress, Is.Not.Null);
            Assert.That(progress.NumberOfConflicts, Is.EqualTo(0));
            Assert.That(progress.NumberOfResolved, Is.EqualTo(0));
            Assert.That(progress.NumberOfExactCopies, Is.EqualTo(0));
        }
Ejemplo n.º 2
0
        public void Folder_And_File()
        {
            AnalysisProgressHelperStub helperStub = new AnalysisProgressHelperStub();
            ProjectFileTree tree = new ProjectFileTree();
            TextFileInformation tfi = new TextFileInformation();
            tfi.RelativeFilePath = "Class.cs";
            tfi.PrevGenFile = tfi.NewGenFile = tfi.UserFile = new TextFile("public class SomeClass { }");
            tree.AddChildNode("folder").AddChildNode(tfi, "Class.cs");

            AnalysisHelper ah = new AnalysisHelper();
            ah.StartAnalysis(helperStub, controller, tree);

            Assert.That(tfi.CurrentDiffResult.DiffType, Is.EqualTo(TypeOfDiff.ExactCopy));

            Assert.That(helperStub.Count, Is.EqualTo(0));
            Assert.That(helperStub.LastProgressObjectList.Count, Is.EqualTo(4));

            AnalyseFilesProgress progress = (AnalyseFilesProgress)helperStub.LastProgressObjectList[2];
            Assert.That(progress, Is.Not.Null);
            Assert.That(progress.NumberOfConflicts, Is.EqualTo(0));
            Assert.That(progress.NumberOfResolved, Is.EqualTo(0));
            Assert.That(progress.NumberOfExactCopies, Is.EqualTo(0));
            Assert.That(progress.ChangedFilePath, Is.EqualTo("folder\\Class.cs"));
            Assert.That(progress.ChangedFileStatus, Is.EqualTo(ProjectFileStatusEnum.Busy));

            progress = (AnalyseFilesProgress)helperStub.LastProgressObjectList[3];
            Assert.That(progress, Is.Not.Null);
            Assert.That(progress.NumberOfConflicts, Is.EqualTo(0));
            Assert.That(progress.NumberOfResolved, Is.EqualTo(0));
            Assert.That(progress.NumberOfExactCopies, Is.EqualTo(1));
            Assert.That(progress.ChangedFilePath, Is.EqualTo("folder\\Class.cs"));
            Assert.That(progress.ChangedFileStatus, Is.EqualTo(ProjectFileStatusEnum.AnalysedFile));
            string nl = Environment.NewLine;
            Assert.That(tfi.CalculateMergedFile(), Is.True);
            Assert.That(tfi.MergedFile.HasContents, Is.True);
            Assert.That(tfi.MergedFile.GetContents(), Is.EqualTo(nl + "public class SomeClass" + nl + "{" + nl + nl + "}"));
        }