|
|
@ -52,7 +52,7 @@ namespace ExtractInterface.Tests { |
|
|
|
string Configure {set;} |
|
|
|
string Configure {set;} |
|
|
|
|
|
|
|
|
|
|
|
IList<int> GetRange(string subject); |
|
|
|
IList<int> GetRange(string subject); |
|
|
|
int MultiplyBy5(int x, |
|
|
|
int MultiplyBy5(int x, |
|
|
|
out bool success); |
|
|
|
out bool success); |
|
|
|
|
|
|
|
|
|
|
|
event EventHandler<UnhandledExceptionEventArgs> ConfigurationChanged; |
|
|
|
event EventHandler<UnhandledExceptionEventArgs> ConfigurationChanged; |
|
|
@ -60,17 +60,17 @@ namespace ExtractInterface.Tests { |
|
|
|
} |
|
|
|
} |
|
|
|
";
|
|
|
|
";
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class TestClass { |
|
|
|
private class TestClass { |
|
|
|
public const string FileName = "TestCase.cs"; |
|
|
|
public const string FileName = "TestCase.cs"; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: write TestClass.FileContent to refactor the string literal code blocks
|
|
|
|
// TODO: write TestClass.FileContent to refactor the string literal code blocks
|
|
|
|
// from the following tests.
|
|
|
|
// from the following tests.
|
|
|
|
public const string FileContent = @""; |
|
|
|
public const string FileContent = @""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region Sanity Test
|
|
|
|
#region Sanity Test
|
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// ensures that the custom assertions in this test fixture are working properly
|
|
|
|
/// ensures that the custom assertions in this test fixture are working properly
|
|
|
@ -151,12 +151,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
|
|
|
|
|
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass(interfaceName, |
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass( |
|
|
|
membersToExtract, |
|
|
|
interfaceName, fileContent, membersToExtract, c, false); |
|
|
|
false, |
|
|
|
|
|
|
|
sourceNamespace, |
|
|
|
|
|
|
|
sourceClassName, |
|
|
|
|
|
|
|
fileContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICompilationUnit icu = helper.Parse(TestClass.FileName, interfaceCode); |
|
|
|
ICompilationUnit icu = helper.Parse(TestClass.FileName, interfaceCode); |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|
IClass i = icu.Classes[0]; |
|
|
@ -206,12 +202,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
|
|
|
|
|
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass(interfaceName, |
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass( |
|
|
|
membersToExtract, |
|
|
|
interfaceName, fileContent, membersToExtract, c, false); |
|
|
|
false, |
|
|
|
|
|
|
|
sourceNamespace, |
|
|
|
|
|
|
|
sourceClassName, |
|
|
|
|
|
|
|
fileContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICompilationUnit icu = helper.Parse(TestClass.FileName, interfaceCode); |
|
|
|
ICompilationUnit icu = helper.Parse(TestClass.FileName, interfaceCode); |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|
IClass i = icu.Classes[0]; |
|
|
@ -265,12 +257,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
|
|
|
|
|
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass(interfaceName, |
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass( |
|
|
|
membersToExtract, |
|
|
|
interfaceName, fileContent, membersToExtract, c, false); |
|
|
|
false, |
|
|
|
|
|
|
|
sourceNamespace, |
|
|
|
|
|
|
|
sourceClassName, |
|
|
|
|
|
|
|
fileContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|
IClass i = icu.Classes[0]; |
|
|
@ -331,12 +319,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
|
|
|
|
|
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass(interfaceName, |
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass( |
|
|
|
membersToExtract, |
|
|
|
interfaceName, fileContent, membersToExtract, c, false); |
|
|
|
false, |
|
|
|
|
|
|
|
sourceNamespace, |
|
|
|
|
|
|
|
sourceClassName, |
|
|
|
|
|
|
|
fileContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|
IClass i = icu.Classes[0]; |
|
|
@ -354,6 +338,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
[Test] |
|
|
|
|
|
|
|
[Ignore("This test is not necessary: we shouldn't require that GenerateInterfaceForClass ignores static methods, " + |
|
|
|
|
|
|
|
"they cannot be selected as memberToExtract in the UI anyways.")] |
|
|
|
public void GenerateInterfaceWithStaticMethodsTest() { |
|
|
|
public void GenerateInterfaceWithStaticMethodsTest() { |
|
|
|
string fileContent = @"
|
|
|
|
string fileContent = @"
|
|
|
|
using System; |
|
|
|
using System; |
|
|
@ -390,12 +376,8 @@ namespace ExtractInterfaceImplicitPropertyTest { |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceClassName = c.Name; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
string sourceNamespace = c.Namespace; |
|
|
|
|
|
|
|
|
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass(interfaceName, |
|
|
|
string interfaceCode = csharpRefactoringProvider.GenerateInterfaceForClass( |
|
|
|
membersToExtract, |
|
|
|
interfaceName, fileContent, membersToExtract, c, false); |
|
|
|
false, |
|
|
|
|
|
|
|
sourceNamespace, |
|
|
|
|
|
|
|
sourceClassName, |
|
|
|
|
|
|
|
fileContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
ICompilationUnit icu = helper.Parse(ITestClass.FileName, interfaceCode); |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|
IClass i = icu.Classes[0]; |
|
|
|