public void DelParam_Spacing_IgnoredSpaces() { string str = "void Test ( int param , char x )"; string method = "Test"; string param = "param"; string expected = "void Test ( char x )"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamBetween_OnlyDesiredParamRemoved() { string str = "void Test(Obj obj, int desiredParam, double x)"; string method = "Test"; string param = "desiredParam"; string expected = "void Test(Obj obj, double x)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_FuncWrong_UnchangedString() { string str = "void Test(int param)"; string method = "Wrong"; string param = "param"; string expected = "void Test(int param)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamWithConst_ConstRemovedToo() { string str = "void Test(const char* param, double x)"; string method = "Test"; string param = "param"; string expected = "void Test( double x)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamWithCustomType_AllSymbolOfTypeRemoved() { string str = "void Test(std::string&&* param, double x)"; string method = "Test"; string param = "param"; string expected = "void Test( double x)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamWithDefaultValue_RemovedParametrAndValue() { string str = "void Test(int param = 12, double x)"; string method = "Test"; string param = "param"; string expected = "void Test( double x)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamsMultiple_RemovedCorrectParametr() { string str = "void Test(int desiredParam, double x)"; string method = "Test"; string param = "desiredParam"; string expected = "void Test( double x)"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
public void DelParam_ParamOne_RemovedParam() { string str = "void Test(int param)"; string method = "Test"; string param = "param"; string expected = "void Test()"; RefactorMethod obj = new RefactorMethod(); string actual = obj.DelParam(str, method, param); Assert.AreEqual(expected, actual); }
private void button1_Click(object sender, EventArgs e) { RefactorMethod refact = new RefactorMethod(); switch (comboBox1.SelectedIndex) { case 0: richTextBox1.Text = refact.DelParam(richTextBox1.Text, textBox1.Text, textBox2.Text); break; case 1: richTextBox1.Text = refact.Rename(richTextBox1.Text, textBox1.Text, textBox2.Text); break; case 2: richTextBox1.Text = Refactor.AddParameter(richTextBox1.Text, textBox1.Text, textBox2.Text); break; case 3: richTextBox1.Text = Refactor.RenameVariable(richTextBox1.Text, textBox1.Text, textBox2.Text); break; } }