Exemple #1
0
 public void ReturnsInputIfNoReturnType()
 {
     bool wasCalled = false;
     Action<string, int> body = (x, y) => { wasCalled = true; };
     var sut = new ParameterizedFunctionInvoker<string>(body);
     sut.SetParameters(42);
     var result = sut.Execute("hello world");
     Assert.That(result, Is.EqualTo("hello world"));
     Assert.That(wasCalled);
 }
Exemple #2
0
 public void ReturnsParam1ForCorrectInput()
 {
     bool wasCalled = false;
     Func<string, int, string> body = (x, y) => { wasCalled = true; return "foo"; };
     var sut = new ParameterizedFunctionInvoker<string>(body);
     sut.SetParameters(42);
     var result = sut.Execute("bar");
     Assert.That(result, Is.EqualTo("foo"));
     Assert.That(wasCalled);
 }
 public void it_returns_param1_for_correct_input()
 {
     bool wasCalled = false;
     Func<string, IDictionary<string, object>, string> body = (x, y) => { wasCalled = true; return "foo"; };
     var sut = new ParameterizedFunctionInvoker<string>(body);
     sut.SetParameters(SetParams(42));
     var result = sut.Execute("bar");
     Assert.That(result, Is.EqualTo("foo"));
     Assert.That(wasCalled);
 }
 public void it_returns_input_if_no_return_type()
 {
     bool wasCalled = false;
     Action<string, IDictionary<string, object>> body = (x, y) => { wasCalled = true; };
     var sut = new ParameterizedFunctionInvoker<string>(body);
     sut.SetParameters(SetParams(42));
     var result = sut.Execute("hello world");
     Assert.That(result, Is.EqualTo("hello world"));
     Assert.That(wasCalled);
 }
Exemple #5
0
        public void it_returns_param1_for_correct_input()
        {
            bool wasCalled = false;
            Func <string, IDictionary <string, object>, string> body = (x, y) => { wasCalled = true; return("foo"); };
            var sut = new ParameterizedFunctionInvoker <string>(body);

            sut.SetParameters(SetParams(42));
            var result = sut.Execute("bar");

            Assert.That(result, Is.EqualTo("foo"));
            Assert.That(wasCalled);
        }
Exemple #6
0
        public void it_returns_input_if_no_return_type()
        {
            bool wasCalled = false;
            Action <string, IDictionary <string, object> > body = (x, y) => { wasCalled = true; };
            var sut = new ParameterizedFunctionInvoker <string>(body);

            sut.SetParameters(SetParams(42));
            var result = sut.Execute("hello world");

            Assert.That(result, Is.EqualTo("hello world"));
            Assert.That(wasCalled);
        }
 public void Given()
 {
     Action<string, int> body = (x, y) => { };
     sut = new ParameterizedFunctionInvoker<string>(body);
 }