Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Structure
Expand Down Expand Up @@ -148,6 +149,98 @@ await VerifyBlockSpansAsync(code,
Region("textspan2", "hint2", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertyGetter3()
{
const string code = @"
class C
{
public string Text
{
$${|hint:get{|textspan:
{
}|}
|}
set
{
}
}
}";

await VerifyBlockSpansAsync(code,
new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(56, 80),
hintSpan: TextSpan.FromBounds(53, 78),
type: BlockTypes.Nonstructural,
bannerText: CSharpStructureHelpers.Ellipsis,
autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertyGetterWithSingleLineComments3()
{
const string code = @"
class C
{
public string Text
{
{|span1:// My
// Getter|}
$${|hint2:get{|textspan2:
{
}|}
|}
set
{
}
}
}
";

await VerifyBlockSpansAsync(code,
Region("span1", "// My ...", autoCollapse: true),
new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(90, 114),
hintSpan: TextSpan.FromBounds(87, 112),
type: BlockTypes.Nonstructural,
bannerText: CSharpStructureHelpers.Ellipsis,
autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertyGetterWithMultiLineComments3()
{
const string code = @"
class C
{
public string Text
{
{|span1:/* My
Getter */|}
$${|hint2:get{|textspan2:
{
}|}
|}
set
{
}
}
}
";

await VerifyBlockSpansAsync(code,
Region("span1", "/* My ...", autoCollapse: true),
new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(93, 117),
hintSpan: TextSpan.FromBounds(90, 115),
type: BlockTypes.Nonstructural,
bannerText: CSharpStructureHelpers.Ellipsis,
autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertySetter1()
{
Expand Down Expand Up @@ -276,5 +369,77 @@ await VerifyBlockSpansAsync(code,
Region("span1", "/* My ...", autoCollapse: true),
Region("textspan2", "hint2", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertySetter3()
{
const string code = @"
class C
{
public string Text
{
get
{
}

$${|hint:set{|textspan:
{
}|}|}
}
}";

await VerifyBlockSpansAsync(code,
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertySetterWithSingleLineComments3()
{
const string code = @"
class C
{
public string Text
{
get
{
}

{|span1:// My
// Setter|}
$${|hint2:set{|textspan2:
{
}|}|}
}
}";

await VerifyBlockSpansAsync(code,
Region("span1", "// My ...", autoCollapse: true),
Region("textspan2", "hint2", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestPropertySetterWithMultiLineComments3()
{
const string code = @"
class C
{
public string Text
{
get
{
}

{|span1:/* My
Setter */|}
$${|hint2:set{|textspan2:
{
}|}|}
}
}";

await VerifyBlockSpansAsync(code,
Region("span1", "/* My ...", autoCollapse: true),
Region("textspan2", "hint2", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,72 @@ class C
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Method2()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:void M(){|textspan: $$=> expression
? trueCase
: falseCase;|}|}
void N() => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Method3()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:void M(){|textspan: $$=> expression
? trueCase
: falseCase;|}|}

void N() => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Method4()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:void M(){|textspan: $$=> expression
? trueCase
: falseCase;|}|}
int N => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Method5()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:void M(){|textspan: $$=> expression
? trueCase
: falseCase;|}|}

int N => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Property1()
{
Expand All @@ -46,6 +112,72 @@ class C
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Property2()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:int M{|textspan: $$=> expression
? trueCase
: falseCase;|}|}
int N => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Property3()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:int M{|textspan: $$=> expression
? trueCase
: falseCase;|}|}

int N => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Property4()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:int M{|textspan: $$=> expression
? trueCase
: falseCase;|}|}
int N() => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_Property5()
{
await VerifyBlockSpansAsync(
@"
class C
{
{|hintspan:int M{|textspan: $$=> expression
? trueCase
: falseCase;|}|}

int N() => 0;
}
",
Region("textspan", "hintspan", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestArrowExpressionClause_LocalFunction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.CodeAnalysis.Text;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Structure
Expand Down Expand Up @@ -137,6 +138,49 @@ await VerifyBlockSpansAsync(code,
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestConstructor9()
{
const string code = @"
class C
{
{|hint:$$public C(){|textspan:
{
}|}|}
public C()
{
}
}";

await VerifyBlockSpansAsync(code,
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestConstructor10()
{
const string code = @"
class C
{
$$public C()
{
}

public C(int x)
{
}
}";

await VerifyBlockSpansAsync(code,
new BlockSpan(
isCollapsible: true,
textSpan: TextSpan.FromBounds(28, 44),
hintSpan: TextSpan.FromBounds(18, 42),
type: BlockTypes.Nonstructural,
bannerText: CSharpStructureHelpers.Ellipsis,
autoCollapse: true));
}

[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestConstructorWithComments()
{
Expand Down
Loading