From fa890675c3662835697d530f7d980f638b62af52 Mon Sep 17 00:00:00 2001 From: Johan Karlsson Date: Tue, 20 Jan 2015 23:59:14 +0000 Subject: [PATCH] Added tests for property initialiser Two work, two don't - depending on where you place the cursor. --- OmniSharp.Tests/AutoComplete/BugFixTests.cs | 79 +++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/OmniSharp.Tests/AutoComplete/BugFixTests.cs b/OmniSharp.Tests/AutoComplete/BugFixTests.cs index dc1bfaa..a9e6ea5 100644 --- a/OmniSharp.Tests/AutoComplete/BugFixTests.cs +++ b/OmniSharp.Tests/AutoComplete/BugFixTests.cs @@ -112,5 +112,84 @@ public MyClass() } }").ShouldContain("String("); } + + [Test] + public void WhenOneSpace_ThenShouldCompleteWithProperty() + { + CompletionsFor( + @" + public class MyClass + { + public class Foo + { + public string Bar { get; set; } + } + + public MyClass() + { + var d = new Foo{ $ + } + }").ShouldContain("Bar"); + } + + [Test] + public void WhenNoSpace_ThenShouldCompleteWithProperty() + { + CompletionsFor( + @" + public class MyClass + { + public class Foo + { + public string Bar { get; set; } + } + + public MyClass() + { + var d = new Foo{$ + } + }").ShouldContain("Bar"); + } + + [Test] + public void WhenNewLine_ThenShouldCompleteWithProperty() + { + CompletionsFor( + @" + public class MyClass + { + public class Foo + { + public string Bar { get; set; } + } + + public MyClass() + { + var d = new Foo { + $ + } + }").ShouldContain("Bar"); + } + + [Test] + public void WhenNewLineCol1_ThenShouldCompleteWithProperty() + { + CompletionsFor( +@" +public class MyClass +{ + public class Foo + { + public string Bar { get; set; } + } + + public MyClass() + { + var d = new Foo { +$ + } +}" + ).ShouldContain("Bar"); + } } }