提交 546577e4 编写于 作者: C CyrusNajmabadi

Add tests.

上级 ed1ff182
......@@ -93,8 +93,10 @@
<AssemblyName>Roslyn.Services.Editor.CSharp.UnitTests</AssemblyName>
<RoslynProjectType>UnitTest</RoslynProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore" />
......@@ -279,6 +281,7 @@
<Compile Include="Formatting\Indentation\SmartTokenFormatterFormatTokenTests.cs" />
<Compile Include="InlineDeclaration\CSharpInlineDeclarationTests_FixAllTests.cs" />
<Compile Include="InlineDeclaration\CSharpInlineDeclarationTests.cs" />
<Compile Include="Structure\InitializerExpressionStructureTests.cs" />
<Compile Include="UseCollectionInitializer\UseCollectionInitializerTests.cs" />
<Compile Include="UseCoalesceExpression\UseCoalesceExpressionForNullableTests.cs" />
<Compile Include="UseCoalesceExpression\UseCoalesceExpressionTests.cs" />
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Structure;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Structure;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Structure
{
public class InitializerExpressionStructureTests : AbstractCSharpSyntaxNodeStructureTests<InitializerExpressionSyntax>
{
internal override AbstractSyntaxStructureProvider CreateProvider()
=> new InitializerExpressionStructureProvider();
[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestOuterInitializer()
{
await VerifyBlockSpansAsync(
@"
class C
{
void M()
{
var v = {|hint:new Dictionary<int, int>{|textspan: $${
{ 1, 2 },
{ 1, 2 },
}|}|};
}
}
",
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: false));
}
[Fact, Trait(Traits.Feature, Traits.Features.Outlining)]
public async Task TestInnerInitializer()
{
await VerifyBlockSpansAsync(
@"
class C
{
void M()
{
var v = new Dictionary<int, int>{
{|hint:{|textspan:$${
1, 2
},|}|}
{ 1, 2 },
};
}
}
",
Region("textspan", "hint", CSharpStructureHelpers.Ellipsis, autoCollapse: false));
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册