20 changed files with 1166 additions and 15 deletions
@ -0,0 +1,100 @@
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// AddAnotherAccessorTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class AddAnotherAccessorTests : ContextActionTestBase |
||||
{ |
||||
[Ignore("Format action is not implemented.")] |
||||
[Test()] |
||||
public void TestAddSet () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new AddAnotherAccessor (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int field;" + Environment.NewLine + |
||||
" public int $Field {" + Environment.NewLine + |
||||
" get {" + Environment.NewLine + |
||||
" return field;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int field;" + Environment.NewLine + |
||||
" public int Field {" + Environment.NewLine + |
||||
" get {" + Environment.NewLine + |
||||
" return field;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" set {" + Environment.NewLine + |
||||
" field = value;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
|
||||
[Ignore("Format action is not implemented.")] |
||||
[Test()] |
||||
public void TestAddGet () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new AddAnotherAccessor (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int field;" + Environment.NewLine + |
||||
" public int $Field {" + Environment.NewLine + |
||||
" set {" + Environment.NewLine + |
||||
" field = value;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int field;" + Environment.NewLine + |
||||
" public int Field {" + Environment.NewLine + |
||||
" get {" + Environment.NewLine + |
||||
" return field;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" set {" + Environment.NewLine + |
||||
" field = value;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// CheckIfParameterIsNullTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class CheckIfParameterIsNullTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new CheckIfParameterIsNull (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (string $param)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" Console.WriteLine (param);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (string param)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" if (param == null)" + Environment.NewLine + |
||||
" throw new ArgumentNullException (\"param\");" + Environment.NewLine + |
||||
" Console.WriteLine (param);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ConvertDecToHexTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class ConvertDecToHexTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new ConvertDecToHex (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" int i = $16;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" int i = 0x10;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,99 @@
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// ConvertForeachToForTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class ConvertForeachToForTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void TestArray () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new ConvertForeachToFor (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (string[] args)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" $foreach (var v in args) {" + Environment.NewLine + |
||||
" Console.WriteLine (v);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (string[] args)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" for (int i = 0; i < args.Length; i++) {" + Environment.NewLine + |
||||
" var v = args [i];" + Environment.NewLine + |
||||
" Console.WriteLine (v);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
|
||||
[Test()] |
||||
public void TestEnumeration () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new ConvertForeachToFor (), |
||||
"using System;" + Environment.NewLine + |
||||
"using System.Collections.Generic;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (List<string> args)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" $foreach (var v in args) {" + Environment.NewLine + |
||||
" Console.WriteLine (v);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"using System.Collections.Generic;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (List<string> args)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" for (int i = 0; i < args.Count; i++) {" + Environment.NewLine + |
||||
" var v = args [i];" + Environment.NewLine + |
||||
" Console.WriteLine (v);" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ConvertHexToDecTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class ConvertHexToDecTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new ConvertHexToDec (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" int i = $0x10;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" int i = 16;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// FlipOperatorArgumentsTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class FlipOperatorArgumentsTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new FlipOperatorArguments (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" if (a $!= b)" + Environment.NewLine + |
||||
" ;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" if (b != a)" + Environment.NewLine + |
||||
" ;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// GenerateGetterTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class GenerateGetterTests : ContextActionTestBase |
||||
{ |
||||
[Ignore("Insert with cursor is not implemented.")] |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new GenerateGetter (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int $myField;" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int myField;" + Environment.NewLine + |
||||
" public int MyField {" + Environment.NewLine + |
||||
" get {" + Environment.NewLine + |
||||
" return myFileld;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// GenerateSwitchLabelsTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class GenerateSwitchLabelsTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new GenerateSwitchLabels (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (ConsoleModifiers mods)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" $switch (mods) {" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test (ConsoleModifiers mods)" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" switch (mods) {" + Environment.NewLine + |
||||
" case ConsoleModifiers.Alt:" + Environment.NewLine + |
||||
" break;" + Environment.NewLine + |
||||
" case ConsoleModifiers.Shift:" + Environment.NewLine + |
||||
" break;" + Environment.NewLine + |
||||
" case ConsoleModifiers.Control:" + Environment.NewLine + |
||||
" break;" + Environment.NewLine + |
||||
" default:" + Environment.NewLine + |
||||
" throw new ArgumentOutOfRangeException ();" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// InsertAnonymousMethodSignatureTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class InsertAnonymousMethodSignatureTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new InsertAnonymousMethodSignature (), |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" EventHandler handler = $delegate {" + Environment.NewLine + |
||||
" };" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"using System;" + Environment.NewLine + |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" EventHandler handler = delegate(object sender, EventArgs e) {" + Environment.NewLine + |
||||
" };" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// IntroduceFormatItemTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class IntroduceFormatItemTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void TestFirst () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new IntroduceFormatItem (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = \"Hello <-World->!\";" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = string.Format (\"Hello {0}!\", \"World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
|
||||
[Test()] |
||||
public void TestSecond () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new IntroduceFormatItem (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = string.Format (\"<-Hello-> {0}!\", \"World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = string.Format (\"{1} {0}!\", \"World\", \"Hello\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// InvertIfTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class InvertIfTestsTests : ContextActionTestBase |
||||
{ |
||||
[Ignore("Formatting not implemented in test context")] |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new InvertIf (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" $if (true) {" + Environment.NewLine + |
||||
" Case1 ();" + Environment.NewLine + |
||||
" } else {" + Environment.NewLine + |
||||
" Case2 ();" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" if (false) {" + Environment.NewLine + |
||||
" Case2 ();" + Environment.NewLine + |
||||
" } else {" + Environment.NewLine + |
||||
" Case1 ();" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// RemoveBackingStoreTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class RemoveBackingStoreTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void Test () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new RemoveBackingStore (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" int field;" + Environment.NewLine + |
||||
" public int $Field {" + Environment.NewLine + |
||||
" get { return field; }" + Environment.NewLine + |
||||
" set { field = value; }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" " + Environment.NewLine + |
||||
" public int Field {" + Environment.NewLine + |
||||
" get;" + Environment.NewLine + |
||||
" set;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// RemoveBracesTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class RemoveBracesTests : ContextActionTestBase |
||||
{ |
||||
[Ignore("Formatting not implemented in test context")] |
||||
[Test()] |
||||
public void TestSimpleBraces () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new RemoveBraces (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" if (true) ${" + Environment.NewLine + |
||||
" ;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" ;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ReplaceEmptyStringTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class ReplaceEmptyStringTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void TestSimpleString() |
||||
{ |
||||
string result = RunContextAction ( |
||||
new ReplaceEmptyString (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = $\"\";" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" string str = string.Empty;" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// SplitStringTests.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Krüger <mkrueger@xamarin.com>
|
||||
//
|
||||
// Copyright (c) 2012 Xamarin Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.NRefactory.CSharp.Refactoring; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp.ContextActions |
||||
{ |
||||
[TestFixture] |
||||
public class SplitStringTests : ContextActionTestBase |
||||
{ |
||||
[Test()] |
||||
public void TestSimpleString () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new SplitString (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" System.Console.WriteLine (\"Hello$World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" System.Console.WriteLine (\"Hello\" + \"World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
|
||||
[Test()] |
||||
public void TestVerbatimString () |
||||
{ |
||||
string result = RunContextAction ( |
||||
new SplitString (), |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" System.Console.WriteLine (@\"Hello$World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}" |
||||
); |
||||
|
||||
Assert.AreEqual ( |
||||
"class TestClass" + Environment.NewLine + |
||||
"{" + Environment.NewLine + |
||||
" void Test ()" + Environment.NewLine + |
||||
" {" + Environment.NewLine + |
||||
" System.Console.WriteLine (@\"Hello\" + @\"World\");" + Environment.NewLine + |
||||
" }" + Environment.NewLine + |
||||
"}", result); |
||||
} |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue