Ejemplo n.º 1
0
        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" });
        }
Ejemplo n.º 2
0
        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" });
        }
Ejemplo n.º 3
0
        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" });
        }