Exemplo n.º 1
0
        private static void BeginTestExecution(string solutionDir, string testFileDir)
        {
            ClearTempPath();

            var type     = GetLookupType(testFileDir);
            var solution = SolutionFile.Load(solutionDir);

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("\nDetermening files To compile");
            Console.WriteLine("-------------------------------");

            var buildFiles = BuildMonkey.Using(new NRefactorySourceExaminer(), solution, new SourceFromFileRepository())
                             .WhatFilesAreRequiredToBuild(type);

            CopyBuildFilesToTempDir(buildFiles);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\nCompiling files:");
            Console.WriteLine("-------------------------------");

            var buildFilesCompiler = new BuildFilesCompiler();
            var result             = buildFilesCompiler.Compile(buildFiles);

            ProcessResult(result);
        }
Exemplo n.º 2
0
        public void ShouldNotAddDependencyIfNotInSolution()
        {
            examiner.Stub(e => e.ExamineSource(Arg <string> .Is.Anything)).Return(new List <TypeInfo> {
                "Foo"
            });
            solutionFile.Stub(s => s.FindClassByType(Arg <TypeInfo> .Is.Anything)).Return(new Class("stub"));

            var buildFiles = BuildMonkey
                             .Using(examiner, solutionFile, sourceCodeRepo)
                             .WhatFilesAreRequiredToBuild(string.Empty);

            Assert.That(buildFiles.HasAClassCalled("Foo.cs"), Is.False);
        }
Exemplo n.º 3
0
        public void ShouldRetrieveClassDependenciesFromExaminer()
        {
            const string source   = @"public class Foo() {}";
            var          fooClass = new Class("Foo");

            sourceCodeRepo.Stub(sr => sr.SourceFor(fooClass)).Return(source);

            BuildMonkey
            .Using(examiner, solutionFile, sourceCodeRepo)
            .WhatFilesAreRequiredToBuild(fooClass);

            examiner.AssertWasCalled(e => e.ExamineSource((source)));
        }
Exemplo n.º 4
0
        public void ShouldAddAllReferencesFoundInASolution()
        {
            var references = new List <Reference> {
                new Reference("System.Web")
            };

            solutionFile.Stub(s => s.AllReferences).Return(references);

            var buildFile = BuildMonkey
                            .Using(examiner, solutionFile, sourceCodeRepo)
                            .WhatFilesAreRequiredToBuild(string.Empty);

            Assert.That(buildFile.HasAReferenceCalled("System.Web.dll"));
        }
Exemplo n.º 5
0
        public void ShouldAddDependencyIfInSolution()
        {
            var      fooClass = new Class("Foo.cs");
            TypeInfo type     = "Foo";

            examiner.Stub(e => e.ExamineSource(Arg <string> .Is.Anything)).Return(new List <TypeInfo> {
                type
            });
            solutionFile.Stub(s => s.FindClassByType(type)).Return(fooClass);

            var buildFiles = BuildMonkey
                             .Using(examiner, solutionFile, sourceCodeRepo)
                             .WhatFilesAreRequiredToBuild(string.Empty);

            Assert.That(buildFiles.HasAClassCalled("Foo.cs"));
        }