public void GenerateTypeQuickInfo() { SimpleCodeCompletion.ResetProject(); var code = @"using System; using System.Linq; /// <summary> /// class decl /// </summary> class Script<T,T1,T2> { static public void Main(string[] args) { var p = new Script<int, int, int>(); var d = new DateT|ime(1); } }"; int pos = GetCaretPosition(ref code); string[] info = SimpleCodeCompletion.GetMemberInfo(code, pos, "test.cs", true); var p = Console.Out; Assert.Equal(1, info.Count()); Assert.Equal("Constructor: DateTime(long ticks) (+ 11 overloads)", info.First().GetLine(0)); }
public void GenerateMemeberFullInfo() { SimpleCodeCompletion.ResetProject(); var code = @"using System; using System.Linq; class Script { static public void Main(string[] args) { Console.WriteLine(|args.Length); } }"; int pos = GetCaretPosition(ref code); //Console.WriteLine(| string[] info = SimpleCodeCompletion.GetMemberInfo(code, 131, "test.cs", false) .OrderBy(x => x) .ToArray(); Assert.Equal(19, info.Count()); Assert.Equal("Method: void Console.WriteLine()", info[0].GetLine(0).RemoveOverloadsInfo()); Assert.Equal("Method: void Console.WriteLine(bool value)", info[1].GetLine(0).RemoveOverloadsInfo()); }
public void ComposeMethodFieldTooltip() { SimpleCodeCompletion.ResetProject(); var code = @"using System; using System.Collections.Generic; using System.Linq; class Script { static IEnumerable<List<int>> test = new List<List<int>>(); static public void Main(string[] args) { test.Co|ncat(null); var t = """".Ca|st<char>(); Console.WriteLine(1); } }"; int pos = GetCaretPosition(ref code); var tooltip = SimpleCodeCompletion.GetMemberInfo(code, pos, "test.cs", true); Assert.StartsWith("Method (extension): IEnumerable<List<int>> IEnumerable<List<int>>.Concat<List<int>>(IEnumerable<List<int>> second)", tooltip.First()); //.Ca|st<char>(); tooltip = SimpleCodeCompletion.GetMemberInfo(code, pos - 4, "test.cs", true); Assert.StartsWith("Field: IEnumerable<List<int>> Script.test", tooltip.First()); //Console.Write|Line tooltip = SimpleCodeCompletion.GetMemberInfo(code, pos + 70, "test.cs", true); Assert.StartsWith("Method: void Console.WriteLine(int value) (+ 18 overloads)", tooltip.First()); }
public void ComposeEventPropTooltip() { SimpleCodeCompletion.ResetProject(); var code = @"using System; using System.Collections.Generic; using System.Linq; static class Script { static IEnumerable<List<int>> test = new List<List<int>>(); IEnumerable<List<int>> Test {get { return test;} } event Action action; static public void Main(string[] args) { var t = Script.T|est; action = null; } }"; int pos = GetCaretPosition(ref code); var tooltip = SimpleCodeCompletion.GetMemberInfo(code, pos, "test.cs", true); Assert.StartsWith("Property: IEnumerable<List<int>> Script.Test { get; }", tooltip.First()); //act|ion tooltip = SimpleCodeCompletion.GetMemberInfo(code, pos + 17, "test.cs", true); Assert.StartsWith("Event: Action Script.action", tooltip.First()); }
public void ProcessMethodOverloadsHint() { SimpleCodeCompletion.ResetProject(); //Simulate invoking ShowMathodInfo //Console.WriteLine(| string[] signatures = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { static public void Main(string[] args) { Console.WriteLine(args.Length); } }", 131, "test.cs", false); Assert.Equal(19, signatures.Count()); // may need to be updated for the new .NET versions //Simulate typing... //Console.WriteLine("Time {0}", DateTime.| var popup = new MemberInfoPanel(); popup.AddData(signatures); Assert.Equal(19, popup.items.Count); popup.ProcessMethodOverloadHint(new[] { "Time {0}" }); //'single and more' parameter methods Assert.Equal(18, popup.items.Count); popup.ProcessMethodOverloadHint(new[] { "\"Time {0}\"", "DateTime." }); //'two and more' parameter methods Assert.Equal(6, popup.items.Count); }
public void GenerateConstructorFullInfo() { SimpleCodeCompletion.ResetProject(); //126 - new DateTime(| string[] info = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { static public void Main(string[] args) { new DateTime(1, 1, 1);new Script(); } }", 126, "test.cs", false); Assert.Equal(12, info.Count()); Assert.Equal("Constructor: DateTime() (+ 11 overloads)", info.OrderBy(x => x).First().GetLine(0)); }
public void GenerateConstructorQuickInfo1() { SimpleCodeCompletion.ResetProject(); //121 - new Scrip|t() string[] info = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { static public void Main(string[] args) { new Script(); } }", 121, "test.cs", true); Assert.Equal(1, info.Count()); Assert.Equal("Constructor: Script()", info.First()); }
public void GenerateMemberMethodQuickInfo() { SimpleCodeCompletion.ResetProject(); //Console.Wri|teLine string[] info = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { static public void Main(string[] args) { Console.WriteLine(args.Length); } }", 124, "test.cs", true); Assert.Equal(1, info.Count()); Assert.Equal("Method: void Console.WriteLine() (+ 18 overload(s))", info.First().GetLines(2).First()); }
public void GenerateTypeDeclarationQuickInfo() { SimpleCodeCompletion.ResetProject(); //61 - Scr|ipt string[] info = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { Script script; static public void Main(string[] args) { } }", 61, "test.cs", true); Assert.Equal(1, info.Count()); Assert.Equal("Type: Script", info.First()); }
public void GenerateConstructorQuickInfo() { SimpleCodeCompletion.ResetProject(); //124 - new DateTim|e( string[] info = SimpleCodeCompletion.GetMemberInfo(@"using System; using System.Linq; class Script { static public void Main(string[] args) { new DateTime(1, 1, 1); } }", 124, "test.cs", true); Assert.Equal(1, info.Count()); var firstLine = info.First().GetLines(2).First(); Assert.Equal("Constructor: DateTime(int year, int month, int day) (+ 11 overloads)", firstLine); }
public void GenerateMemberQuickInfo() { SimpleCodeCompletion.ResetProject(); //132 - Console.Out|putEncoding; var code = @"using System; using System.Linq; class Script { static public void Main(string[] args) { var p = Console.O|ut; } }"; int pos = GetCaretPosition(ref code); string[] info = SimpleCodeCompletion.GetMemberInfo(code, pos, "test.cs", true); var p = Console.Out; Assert.Equal(1, info.Count()); Assert.Equal("Property: TextWriter Console.Out { get; }", info.First().GetLine(0)); }