コード例 #1
0
        public void ShouldThrowIfTargetsAssemblyNotFound()
        {
            var finder = new Mock <IBounceDirectoryFinder>();

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);

            Assert.That(() => parser.GetTargetsAssembly(new[] { "SomeTask", "/other", "args" }), Throws.InstanceOf(typeof(TargetsAssemblyNotFoundException)));
        }
コード例 #2
0
        public void ShouldParseTargetsFromParameterWithColon()
        {
            var finder = new Mock<IBounceDirectoryFinder>();
            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] {"/bounceDir:adir", "other", "args"});

            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] {"other", "args"}));
            Assert.That(targetsAndArgs.BounceDirectory, Is.EqualTo("adir"));
        }
コード例 #3
0
        public void ShouldParseTargetsFromParameter()
        {
            var finder         = new Mock <IBounceDirectoryFinder>();
            var parser         = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] { "/bounceDir", "adir", "other", "args" });

            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] { "other", "args" }));
            Assert.That(targetsAndArgs.BounceDirectory, Is.EqualTo("adir"));
        }
コード例 #4
0
        public void ShouldParseTargetsFromParameter()
        {
            var finder = new Mock<ITargetsAssemblyFinder>();
            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] {"/targets", "one.dll", "other", "args"});

            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] {"other", "args"}));
            Assert.That(targetsAndArgs.TargetsAssembly.Executable, Is.EqualTo("one.dll"));
            Assert.That(targetsAndArgs.TargetsAssembly.ExecutableType, Is.EqualTo(BounceDirectoryExecutableType.Targets));
        }
コード例 #5
0
        public void ShouldAttemptToFindAssemblyIfNoArgsGiven()
        {
            var finder = new Mock<IBounceDirectoryFinder>();
            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new string[0]);

            Assert.That(targetsAndArgs.RemainingArguments, Is.Empty);
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
        }
コード例 #6
0
        public void ShouldAttemptToFindAssemblyIfNoArgsGiven()
        {
            var finder = new Mock<ITargetsAssemblyFinder>();
            var bounceDirectoryExecutable = new BounceDirectoryExecutable();
            finder.Setup(f => f.FindTargetsAssembly()).Returns(bounceDirectoryExecutable);

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new string[0]);

            Assert.That(targetsAndArgs.RemainingArguments, Is.Empty);
            Assert.That(targetsAndArgs.TargetsAssembly, Is.SameAs(bounceDirectoryExecutable));
        }
コード例 #7
0
        public void ShouldParseRecurseFromArguments()
        {
            var finder = new Mock<IBounceDirectoryFinder>();
            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] {"/recurse", "other", "args"});

            Assert.That(targetsAndArgs.Recurse);
            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] { "other", "args" }));
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
        }
コード例 #8
0
        public void ShouldFindTargetsIfNoTargetsParameterGiven()
        {
            var finder = new Mock<IBounceDirectoryFinder>();
            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] {"build", "SomeTarget", "/other", "args"});

            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] {"build", "SomeTarget", "/other", "args"}));
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
            Assert.That(targetsAndArgs.Recurse, Is.False);
        }
コード例 #9
0
        public void ShouldAttemptToFindAssemblyIfNoArgsGiven()
        {
            var finder = new Mock <IBounceDirectoryFinder>();

            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser         = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new string[0]);

            Assert.That(targetsAndArgs.RemainingArguments, Is.Empty);
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
        }
コード例 #10
0
        public void ShouldFindTargetsIfNoTargetsParameterGiven()
        {
            var finder = new Mock <IBounceDirectoryFinder>();

            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser         = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] { "build", "SomeTarget", "/other", "args" });

            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] { "build", "SomeTarget", "/other", "args" }));
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
            Assert.That(targetsAndArgs.Recurse, Is.False);
        }
コード例 #11
0
        public void ShouldParseRecurseFromArguments()
        {
            var finder = new Mock <IBounceDirectoryFinder>();

            finder.Setup(f => f.FindBounceDirectory()).Returns(@"path\to\bounce");

            var parser         = new TargetsAssemblyArgumentsParser(finder.Object);
            var targetsAndArgs = parser.GetTargetsAssembly(new[] { "/recurse", "other", "args" });

            Assert.That(targetsAndArgs.Recurse);
            Assert.That(targetsAndArgs.RemainingArguments, Is.EqualTo(new[] { "other", "args" }));
            Assert.That(targetsAndArgs.BounceDirectory, Is.SameAs(@"path\to\bounce"));
        }
コード例 #12
0
        public void ShouldThrowIfTargetsAssemblyNotFound()
        {
            var finder = new Mock<ITargetsAssemblyFinder>();
            finder.Setup(f => f.FindTargetsAssembly()).Returns((BounceDirectoryExecutable) null);

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            Assert.That(() => parser.GetTargetsAssembly(new[] {"build", "SomeTarget", "/other", "args"}), Throws.InstanceOf(typeof(TargetsAssemblyNotFoundException)));
        }
コード例 #13
0
        public void ShouldThrowIfTargetsAssemblyNotFound()
        {
            var finder = new Mock<IBounceDirectoryFinder>();

            var parser = new TargetsAssemblyArgumentsParser(finder.Object);
            Assert.That(() => parser.GetTargetsAssembly(new[] {"SomeTask", "/other", "args"}), Throws.InstanceOf(typeof(TargetsAssemblyNotFoundException)));
        }