public void Throw_if_method_require_parameter_but_no_parameter_provided() { //Arrange privateTester = new Core.PrivateTester <PrivateMethodClass>( new PrivateMethodFinder <PrivateMethodClass>() ); //Assert var methodName = "PrivateMethodWithParameter"; Assert.Throws <Core.InvalidArgumentListException>( () => privateTester.InvokePrivateMethod(methodName) ); }
public void Throw_if_parameter_number_is_diffrent_than_required() { //Arrange privateTester = new Core.PrivateTester <PrivateMethodClass>( new PrivateMethodFinder <PrivateMethodClass>() ); //Assert var methodName = "PrivateMethodWithParameter"; Assert.Throws <Core.InvalidArgumentListException>( () => privateTester.InvokePrivateMethod(methodName, 1, 3) ); }
public void Call_method_with_given_name() { //Arrange privateTester = new Core.PrivateTester <PrivateMethodClass>( new PrivateMethodFinder <PrivateMethodClass>() ); //Act privateTester.InvokePrivateMethod("PrivateMethod"); //Assert Assert.Equal(1, PrivateMethodClass.privateMethodCalls); Assert.Equal(0, PrivateMethodClass.publicMethodCalls); }
public void Throw_if_class_has_no_method_with_given_type() { //Arrange privateTester = new Core.PrivateTester <PrivateMethodClass>( new PrivateMethodFinder <PrivateMethodClass>() ); //Assert var methodName = "NotExistentMethod"; Assert.Throws <InvalidOperationException>( () => privateTester.InvokePrivateMethod(methodName) ); }
public void Call_method_with_given_name_and_provide_parameters() { //Arrange privateTester = new Core.PrivateTester <PrivateMethodClass>( new PrivateMethodFinder <PrivateMethodClass>() ); //Act privateTester.InvokePrivateMethod("PrivateMethodWithParameter", 1); //Assert Assert.Equal(1, PrivateMethodClass.privateMethodCalls); Assert.Equal(0, PrivateMethodClass.publicMethodCalls); Assert.Equal(1, PrivateMethodClass.passedParameter); }