Exemplo n.º 1
0
 public void TestTryCallWithEmptyArgumentShouldInvokeMethod1()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { } );
     Assert.AreEqual( 1, obj.MethodInvoked );
     // check that we also work when passing in unused parameters
     obj.TryCallMethod( "Eat", false, new { size=1 } );
     Assert.AreEqual( 1, obj.MethodInvoked );
 }
Exemplo n.º 2
0
 public void TestTryCallWithCountAndFoodAndIsHayArgumentsShouldInvokeMethod5()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { count=2.0, food="hay", isHay=true } );
     Assert.AreEqual( 5, obj.MethodInvoked );
     // try with argument that must be type converted
     obj.TryCallMethod( "Eat", true, new { count=2, food="hay", isHay=true } );
     Assert.AreEqual( 5, obj.MethodInvoked );
 }
Exemplo n.º 3
0
 public void TestTryCallWithNonMatchShouldThrow()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { size=1 } );
 }
Exemplo n.º 4
0
 public void TestTryCallWithFoodArgumentShouldInvokeMethod2()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { food="hay" } );
     Assert.AreEqual( 2, obj.MethodInvoked );
 }
Exemplo n.º 5
0
 public void TestTryCallWithCountArgumentsShouldInvokeMethod3()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { count=2 } );
     Assert.AreEqual( 3, obj.MethodInvoked );
 }
Exemplo n.º 6
0
 public void TestTryCallWithCountAndFoodArgumentsShouldInvokeMethod4()
 {
     var obj = new Elephant();
     obj.TryCallMethod( "Eat", true, new { count=2, food="hay" } );
     Assert.AreEqual( 4, obj.MethodInvoked );
 }