1- namespace ProjectFileConverter . Tests
1+ namespace ProjectFileConverter . Tests
22{
33 using System . Xml . Linq ;
44 using NUnit . Framework ;
@@ -12,31 +12,33 @@ public class ItemGroup
1212 public void CsFiles ( bool isWpf )
1313 {
1414 var element = XElement . Parse (
15- @"
16- <ItemGroup>
17- <Compile Include=""IGetter.cs"" />
18- <Compile Include=""Internals\Factory{TArg,T}.cs"" />
19- <Compile Include=""Internals\Factory{T}.cs"" />
20- <Compile Include=""Internals\IFactory.cs"" />
21- <Compile Include=""Settings\AssemblySettings.cs"" />
22- <Compile Include=""Settings\Constructor.cs"" />
23- <Compile Include=""Exceptions\AmbiguousBindingException.cs"" />
24- <Compile Include=""Exceptions\AmbiguousGenericBindingException.cs"" />
25- <Compile Include=""Exceptions\BindingException.cs"" />
26- <Compile Include=""Exceptions\CircularDependencyException.cs"" />
27- <Compile Include=""Exceptions\NoBindingException.cs"" />
28- <Compile Include=""Internals\Ctor.cs"" />
29- <Compile Include=""Internals\ConcurrentDictionaryPool.cs"" />
30- <Compile Include=""Kernel.cs"" />
31- <Compile Include=""Internals\TypeMap.cs"" />
32- <Compile Include=""Properties\AssemblyInfo.cs"" />
33- <Compile Include=""Internals\TypeExt.cs"" />
34- <Compile Include=""Exceptions\ResolveException.cs"" />
35- <Compile Include=""Settings\ConstructorSettings.cs"" />
36- <Compile Include=""Settings\DisposeSettings.cs"" />
37- <Compile Include=""Settings\Settings.cs"" />
38- <Compile Include=""Settings\Visibility.cs"" />
39- </ItemGroup>" ) ;
15+ """
16+
17+ <ItemGroup>
18+ <Compile Include="IGetter.cs" />
19+ <Compile Include="Internals\Factory{TArg,T}.cs" />
20+ <Compile Include="Internals\Factory{T}.cs" />
21+ <Compile Include="Internals\IFactory.cs" />
22+ <Compile Include="Settings\AssemblySettings.cs" />
23+ <Compile Include="Settings\Constructor.cs" />
24+ <Compile Include="Exceptions\AmbiguousBindingException.cs" />
25+ <Compile Include="Exceptions\AmbiguousGenericBindingException.cs" />
26+ <Compile Include="Exceptions\BindingException.cs" />
27+ <Compile Include="Exceptions\CircularDependencyException.cs" />
28+ <Compile Include="Exceptions\NoBindingException.cs" />
29+ <Compile Include="Internals\Ctor.cs" />
30+ <Compile Include="Internals\ConcurrentDictionaryPool.cs" />
31+ <Compile Include="Kernel.cs" />
32+ <Compile Include="Internals\TypeMap.cs" />
33+ <Compile Include="Properties\AssemblyInfo.cs" />
34+ <Compile Include="Internals\TypeExt.cs" />
35+ <Compile Include="Exceptions\ResolveException.cs" />
36+ <Compile Include="Settings\ConstructorSettings.cs" />
37+ <Compile Include="Settings\DisposeSettings.cs" />
38+ <Compile Include="Settings\Settings.cs" />
39+ <Compile Include="Settings\Visibility.cs" />
40+ </ItemGroup>
41+ """ ) ;
4042
4143 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
4244 Assert . AreEqual ( null , migrated ) ;
@@ -47,19 +49,21 @@ public void CsFiles(bool isWpf)
4749 public void ResxFiles ( bool isWpf )
4850 {
4951 var element = XElement . Parse (
50- @"
51- <ItemGroup>
52- <Compile Include=""Properties\Resources.Designer.cs"">
53- <AutoGen>True</AutoGen>
54- <DesignTime>True</DesignTime>
55- <DependentUpon>Resources.resx</DependentUpon>
56- </Compile>
57- <EmbeddedResource Include=""Properties\Resources.resx"">
58- <Generator>PublicResXFileCodeGenerator</Generator>
59- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
60- <SubType>Designer</SubType>
61- </EmbeddedResource>
62- </ItemGroup>" ) ;
52+ """
53+
54+ <ItemGroup>
55+ <Compile Include="Properties\Resources.Designer.cs">
56+ <AutoGen>True</AutoGen>
57+ <DesignTime>True</DesignTime>
58+ <DependentUpon>Resources.resx</DependentUpon>
59+ </Compile>
60+ <EmbeddedResource Include="Properties\Resources.resx">
61+ <Generator>PublicResXFileCodeGenerator</Generator>
62+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
63+ <SubType>Designer</SubType>
64+ </EmbeddedResource>
65+ </ItemGroup>
66+ """ ) ;
6367
6468 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
6569 Assert . AreEqual ( null , migrated ) ;
@@ -70,11 +74,13 @@ public void ResxFiles(bool isWpf)
7074 public void DefaultFrameworkReferences ( bool isWpf )
7175 {
7276 var element = XElement . Parse (
73- @"
74- <ItemGroup>
75- <Reference Include=""System"" />
76- <Reference Include=""System.Core"" />
77- </ItemGroup>" ) ;
77+ """
78+
79+ <ItemGroup>
80+ <Reference Include="System" />
81+ <Reference Include="System.Core" />
82+ </ItemGroup>
83+ """ ) ;
7884
7985 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
8086 Assert . AreEqual ( null , migrated ) ;
@@ -84,63 +90,71 @@ public void DefaultFrameworkReferences(bool isWpf)
8490 public void FrameworkReferences ( )
8591 {
8692 var element = XElement . Parse (
87- @"
88- <ItemGroup>
89- <Reference Include=""System"" />
90- <Reference Include=""System.Core"" />
91- <Reference Include=""System.Windows"" />
92- <Reference Include=""Accessibility"" />
93- <Reference Include=""PresentationCore"" />
94- <Reference Include=""PresentationFramework"" />
95- <Reference Include=""System.Windows.Forms"" />
96- <Reference Include=""System.Xaml"" />
97- <Reference Include=""UIAutomationClient"" />
98- <Reference Include=""UIAutomationTypes"" />
99- <Reference Include=""WindowsBase"" />
100- </ItemGroup>" ) ;
93+ """
94+
95+ <ItemGroup>
96+ <Reference Include="System" />
97+ <Reference Include="System.Core" />
98+ <Reference Include="System.Windows" />
99+ <Reference Include="Accessibility" />
100+ <Reference Include="PresentationCore" />
101+ <Reference Include="PresentationFramework" />
102+ <Reference Include="System.Windows.Forms" />
103+ <Reference Include="System.Xaml" />
104+ <Reference Include="UIAutomationClient" />
105+ <Reference Include="UIAutomationTypes" />
106+ <Reference Include="WindowsBase" />
107+ </ItemGroup>
108+ """ ) ;
101109
102110 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf : false , out var migrated ) ) ;
103- var expected = @"<ItemGroup>
104- <Reference Include=""System.Windows"" />
105- <Reference Include=""Accessibility"" />
106- <Reference Include=""PresentationCore"" />
107- <Reference Include=""PresentationFramework"" />
108- <Reference Include=""System.Windows.Forms"" />
109- <Reference Include=""System.Xaml"" />
110- <Reference Include=""UIAutomationClient"" />
111- <Reference Include=""UIAutomationTypes"" />
112- <Reference Include=""WindowsBase"" />
113- </ItemGroup>" ;
111+ var expected = """
112+ <ItemGroup>
113+ <Reference Include="System.Windows" />
114+ <Reference Include="Accessibility" />
115+ <Reference Include="PresentationCore" />
116+ <Reference Include="PresentationFramework" />
117+ <Reference Include="System.Windows.Forms" />
118+ <Reference Include="System.Xaml" />
119+ <Reference Include="UIAutomationClient" />
120+ <Reference Include="UIAutomationTypes" />
121+ <Reference Include="WindowsBase" />
122+ </ItemGroup>
123+ """ ;
114124 Assert . AreEqual ( expected , migrated . ToString ( ) ) ;
115125 }
116126
117127 [ Test ]
118128 public void FrameworkReferencesWpf ( )
119129 {
120130 var element = XElement . Parse (
121- @"
122- <ItemGroup>
123- <Reference Include=""System"" />
124- <Reference Include=""System.Core"" />
125- <Reference Include=""System.Windows"" />
126- <Reference Include=""Accessibility"" />
127- <Reference Include=""PresentationCore"" />
128- <Reference Include=""PresentationFramework"" />
129- <Reference Include=""System.Windows.Forms"" />
130- <Reference Include=""System.Xaml"" />
131- <Reference Include=""UIAutomationClient"" />
132- <Reference Include=""UIAutomationTypes"" />
133- <Reference Include=""WindowsBase"" />
134- </ItemGroup>" ) ;
131+ """
132+
133+ <ItemGroup>
134+ <Reference Include="System" />
135+ <Reference Include="System.Core" />
136+ <Reference Include="System.Windows" />
137+ <Reference Include="Accessibility" />
138+ <Reference Include="PresentationCore" />
139+ <Reference Include="PresentationFramework" />
140+ <Reference Include="System.Windows.Forms" />
141+ <Reference Include="System.Xaml" />
142+ <Reference Include="UIAutomationClient" />
143+ <Reference Include="UIAutomationTypes" />
144+ <Reference Include="WindowsBase" />
145+ </ItemGroup>
146+ """ ) ;
135147
136148 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf : true , out var migrated ) ) ;
137- var expected = @"<ItemGroup>
138- <Reference Include=""System.Windows"" />
139- <Reference Include=""Accessibility"" />
140- <Reference Include=""System.Windows.Forms"" />
141- <Reference Include=""UIAutomationClient"" />
142- <Reference Include=""UIAutomationTypes"" />
143- </ItemGroup>" ;
149+ var expected = """
150+ <ItemGroup>
151+ <Reference Include="System.Windows" />
152+ <Reference Include="Accessibility" />
153+ <Reference Include="System.Windows.Forms" />
154+ <Reference Include="UIAutomationClient" />
155+ <Reference Include="UIAutomationTypes" />
156+ </ItemGroup>
157+ """ ;
144158 Assert . AreEqual ( expected , migrated . ToString ( ) ) ;
145159 }
146160
@@ -149,18 +163,22 @@ public void FrameworkReferencesWpf()
149163 public void ProjectReference ( bool isWpf )
150164 {
151165 var element = XElement . Parse (
152- @"
153- <ItemGroup>
154- <ProjectReference Include=""..\Gu.Inject\Gu.Inject.csproj"">
155- <Project>{8953C8E1-0819-4EB8-B10C-5286DEB0E079}</Project>
156- <Name>Gu.Inject</Name>
157- </ProjectReference>
158- </ItemGroup>" ) ;
166+ """
167+
168+ <ItemGroup>
169+ <ProjectReference Include="..\Gu.Inject\Gu.Inject.csproj">
170+ <Project>{8953C8E1-0819-4EB8-B10C-5286DEB0E079}</Project>
171+ <Name>Gu.Inject</Name>
172+ </ProjectReference>
173+ </ItemGroup>
174+ """ ) ;
159175
160176 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
161- var expected = @"<ItemGroup>
162- <ProjectReference Include=""..\Gu.Inject\Gu.Inject.csproj"" />
163- </ItemGroup>" ;
177+ var expected = """
178+ <ItemGroup>
179+ <ProjectReference Include="..\Gu.Inject\Gu.Inject.csproj" />
180+ </ItemGroup>
181+ """ ;
164182 Assert . AreEqual ( expected , migrated . ToString ( ) ) ;
165183 }
166184
@@ -169,15 +187,17 @@ public void ProjectReference(bool isWpf)
169187 public void AnalyzersPaket ( bool isWpf )
170188 {
171189 var element = XElement . Parse (
172- @"
173- <ItemGroup>
174- <Analyzer Include=""..\packages\analyzers\Gu.Analyzers\analyzers\dotnet\cs\Gu.Analyzers.Analyzers.dll"">
175- <Paket>True</Paket>
176- </Analyzer>
177- <Analyzer Include=""..\packages\analyzers\Gu.Analyzers\analyzers\dotnet\cs\Gu.Analyzers.CodeFixes.dll"">
178- <Paket>True</Paket>
179- </Analyzer>
180- </ItemGroup>" ) ;
190+ """
191+
192+ <ItemGroup>
193+ <Analyzer Include="..\packages\analyzers\Gu.Analyzers\analyzers\dotnet\cs\Gu.Analyzers.Analyzers.dll">
194+ <Paket>True</Paket>
195+ </Analyzer>
196+ <Analyzer Include="..\packages\analyzers\Gu.Analyzers\analyzers\dotnet\cs\Gu.Analyzers.CodeFixes.dll">
197+ <Paket>True</Paket>
198+ </Analyzer>
199+ </ItemGroup>
200+ """ ) ;
181201
182202 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
183203 Assert . AreEqual ( null , migrated ) ;
@@ -188,19 +208,23 @@ public void AnalyzersPaket(bool isWpf)
188208 public void NugetReferences ( bool isWpf )
189209 {
190210 var element = XElement . Parse (
191- @"
192- <ItemGroup>
193- <None Include=""packages.config"" />
194- <Reference Include=""MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL"">
195- <HintPath>..\..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
196- <Private>True</Private>
197- </Reference>
198- </ItemGroup>" ) ;
211+ """
212+
213+ <ItemGroup>
214+ <None Include="packages.config" />
215+ <Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
216+ <HintPath>..\..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
217+ <Private>True</Private>
218+ </Reference>
219+ </ItemGroup>
220+ """ ) ;
199221
200222 Assert . AreEqual ( true , Migrate . ItemGroup . TryMigrate ( element , isWpf , out var migrated ) ) ;
201- var expected = @"<ItemGroup>
202- <PackageReference Include=""MySql.Data"" Version=""6.9.9"" />
203- </ItemGroup>" ;
223+ var expected = """
224+ <ItemGroup>
225+ <PackageReference Include="MySql.Data" Version="6.9.9" />
226+ </ItemGroup>
227+ """ ;
204228 Assert . AreEqual ( expected , migrated . ToString ( ) ) ;
205229 }
206230 }
0 commit comments