Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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>());
 }
Ejemplo n.º 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>());
 }
Ejemplo n.º 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>());
        }
Ejemplo n.º 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>());
 }