public void ShouldRemoveParametersInAnyOrder() { var sandbox = SandboxFactory.Create(AppDomain.CurrentDomain.SetupInformation); var methodInfo = sandbox.GetStepMethods().First(info => info.Name == "RefactoringSaySomething"); var parameterPosition = ParameterPosition.CreateBuilder().SetNewPosition(0).SetOldPosition(1).Build(); RefactorHelper.Refactor(methodInfo, new List <ParameterPosition> { parameterPosition }, new List <string>(), "Refactoring Say something to <who>"); AssertParametersExist(methodInfo.Name, new[] { "who" }); }
public void ShouldAddParametersWithReservedKeywordName() { const string newStepValue = "Refactoring this is a test step <class>"; var sandbox = SandboxFactory.Create(AppDomain.CurrentDomain.SetupInformation); var methodInfo = sandbox.GetStepMethods().First(info => info.Name == "RefactoringSampleTest"); var parameterPositions = new List <ParameterPosition> { ParameterPosition.CreateBuilder().SetNewPosition(0).SetOldPosition(-1).Build() }; RefactorHelper.Refactor(methodInfo, parameterPositions, new List <string> { "class" }, newStepValue); AssertStepAttributeWithTextExists(methodInfo.Name, newStepValue); AssertParametersExist(methodInfo.Name, new[] { "@class" }); }
public void ShouldReorderParameters() { const string newStepValue = "Refactoring Say <who> to <what>"; var sandbox = SandboxFactory.Create(AppDomain.CurrentDomain.SetupInformation); var methodInfo = sandbox.GetStepMethods().First(info => info.Name == "RefactoringSaySomething"); var parameterPosition = ParameterPosition.CreateBuilder().SetNewPosition(1).SetOldPosition(0).Build(); var parameterPosition1 = ParameterPosition.CreateBuilder().SetNewPosition(0).SetOldPosition(1).Build(); var parameterPositions = new List <ParameterPosition> { parameterPosition, parameterPosition1 }; RefactorHelper.Refactor(methodInfo, parameterPositions, new List <string> { "who", "what" }, newStepValue); AssertStepAttributeWithTextExists(methodInfo.Name, newStepValue); AssertParametersExist(methodInfo.Name, new[] { "who", "what" }); }