예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }
예제 #4
0
        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"));
        }
예제 #5
0
        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"));
        }
예제 #6
0
        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"));
        }
예제 #7
0
        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"));
        }
예제 #8
0
        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"));
        }
예제 #9
0
        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"));
        }
예제 #10
0
        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"));
        }
예제 #11
0
        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"));
        }
예제 #12
0
        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"));
        }
예제 #13
0
        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);
 }
예제 #15
0
 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>());
 }
예제 #16
0
 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>());
 }
예제 #17
0
        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>());
        }
예제 #18
0
 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>());
 }