public void InvokesTaskMethodWithOptionalStringParameterGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Optional"), Resolver); task.Invoke(new Arguments(new Dictionary<string, string>{{"fileName", "thefile.txt"}})); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"optional fileName: thefile.txt")); }
public void InvokesTaskMethodWithStringParameter() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Deploy"), Resolver); task.Invoke(new TaskParameters(new Dictionary<string, string> { { "dir", @"c:\sites" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"deploying c:\sites")); }
public void InvokesTaskMethodWithNullableIntParameterGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Nullable"), Resolver); task.Invoke(new TaskParameters(new Dictionary<string, string>{{"port", "80"}})); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"port: 80")); }
public void InvokesTaskMethodWithOptionalStringParameterNotGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Optional"), Resolver); task.Invoke(new TaskParameters(new Dictionary<string, string>())); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"optional fileName: stuff.txt")); }
public void InvokesTaskMethodWithNoParameters() { var task = new TaskMethod(typeof (FakeTaskClass).GetMethod("Compile"), Resolver); task.Invoke(new TaskParameters(new Dictionary<string, string>())); Assert.That(Output.ToString().Trim(), Is.EqualTo("compiling")); }
public void InvokesTaskMethodWithBooleanParameter() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Test"), Resolver); task.Invoke(new TaskParameters(new Dictionary<string, string> { { "fast", @"true" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"testing fast")); }
public void InvokesTaskMethodWithOptionalStringParameterNotGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Optional"), Resolver); task.Invoke(new TaskParameters(new Dictionary <string, string>())); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"optional fileName: stuff.txt")); }
public void InvokesTaskMethodWithNoParameters() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Compile"), Resolver); task.Invoke(new TaskParameters(new Dictionary <string, string>())); Assert.That(Output.ToString().Trim(), Is.EqualTo("compiling")); }
public void InvokesTaskMethodWithBooleanParameter() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Test"), Resolver); task.Invoke(new TaskParameters(new Dictionary <string, string> { { "fast", @"true" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"testing fast")); }
public void InvokesTaskMethodWithStringParameter() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Deploy"), Resolver); task.Invoke(new TaskParameters(new Dictionary <string, string> { { "dir", @"c:\sites" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"deploying c:\sites")); }
public void InvokesTaskMethodWithNullableIntParameterGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Nullable"), Resolver); task.Invoke(new TaskParameters(new Dictionary <string, string> { { "port", "80" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"port: 80")); }
public void InvokesTaskMethodWithOptionalStringParameterGiven() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Optional"), Resolver); task.Invoke(new Arguments(new Dictionary <string, string> { { "fileName", "thefile.txt" } })); Assert.That(Output.ToString().Trim(), Is.EqualTo(@"optional fileName: thefile.txt")); }
public void TaskExceptionIsThrownWhenTaskThrows() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Throws"), Resolver); Assert.That(() => task.Invoke(new TaskParameters(new Dictionary <string, string>())), Throws.InstanceOf <TaskException>()); }
public void DoTask() { taskMethod.Invoke(model); }
public void TaskExceptionIsThrownWhenTaskThrows() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Throws"), Resolver); Assert.That(() => task.Invoke(new TaskParameters(new Dictionary<string, string>())), Throws.InstanceOf<TaskException>()); }
public void ThrowsExceptionWhenTaskRequiredParameterNotProvided() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Test"), Resolver); Assert.That(() => task.Invoke(new TaskParameters(new Dictionary<string, string>())), Throws.InstanceOf<TaskRequiredParameterException>()); }
public void ThrowsExceptionWhenTaskRequiredParameterNotProvided() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Test"), Resolver); Assert.That(() => task.Invoke(new TaskParameters(new Dictionary <string, string>())), Throws.InstanceOf <TaskRequiredParameterException>()); }
public void ThrowsExceptionWhenCustomTypeCannotBeParsed() { var task = new TaskMethod(typeof(FakeTaskClass).GetMethod("Bad"), Resolver); Assert.That(() => task.Invoke(new TaskParameters(new Dictionary<string, string> { { "x", @"something" } })), Throws.InstanceOf<TaskParameterException>()); }