Browse Source

Added new completion test case + bugfix.

newNRvisualizers
mike 14 years ago committed by mike
parent
commit
d66eb1dcda
  1. 67
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ObjectInitializerTests.cs

67
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/ObjectInitializerTests.cs

@ -264,6 +264,73 @@ class MyTest @@ -264,6 +264,73 @@ class MyTest
Assert.IsNotNull (provider.Find ("Str"), "field 'Str' not found.");
});
}
/// <summary>
/// Bug 2434 - Object-Initializer Intellisense broken when using constructor arguments
/// </summary>
[Test()]
public void TestBug2434 ()
{
CodeCompletionBugTests.CombinedProviderTest (
@"
class User
{
public User() {}
public User(int id) { }
public string Id { get; set; }
public string Name { get; set; }
}
class MyTest
{
static string Str = ""hello"";
public void Test ()
{
$new User(12) {
N$
}
}
", provider => {
Assert.IsNotNull (provider.Find ("Id"), "Property 'Id' not found.");
Assert.IsNotNull (provider.Find ("Name"), "Property 'Name' not found.");
});
}
[Test()]
public void TestBug2434Case2 ()
{
CodeCompletionBugTests.CombinedProviderTest (
@"
class User
{
public User() {}
public User(int id) { }
public string Id { get; set; }
public string Name { get; set; }
}
class MyTest
{
static string Str = ""hello"";
public void Test ()
{
string myString;
$new User(12) {
Name = S$
}
}
", provider => {
Assert.IsNull (provider.Find ("Id"), "Property 'Id' found.");
Assert.IsNull (provider.Find ("Name"), "Property 'Name' found.");
Assert.IsNotNull (provider.Find ("Str"), "Field 'Str' not found.");
Assert.IsNotNull (provider.Find ("myString"), "Local 'myString' not found.");
});
}
}
}

Loading…
Cancel
Save