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))); }
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")); }
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")); }
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)); }
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")); }
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)); }
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")); }
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); }
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")); }
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); }
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")); }
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))); }
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))); }