File tree 3 files changed +52
-4
lines changed
Buildalyzer.Tests/Integration
projects/ProjectFileAsAdditionalFile
3 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -704,10 +704,31 @@ public void GetsAdditionalFile()
704
704
StringWriter log = new StringWriter ( ) ;
705
705
IProjectAnalyzer analyzer = GetProjectAnalyzer ( @"ProjectWithAdditionalFile\ProjectWithAdditionalFile.csproj" , log ) ;
706
706
707
- // When + then
708
- analyzer . Build ( ) . First ( ) . AdditionalFiles . Select ( Path . GetFileName )
709
- . Should ( ) . BeEquivalentTo ( "message.txt" ) ;
710
- }
707
+ // When
708
+ IEnumerable < string > additionalFiles = analyzer . Build ( ) . First ( ) . AdditionalFiles ;
709
+
710
+ [ Test ]
711
+ public void GetsProjectFileAsAdditionalFile ( )
712
+ {
713
+ // Given
714
+ StringWriter log = new StringWriter ( ) ;
715
+ IProjectAnalyzer analyzer = GetProjectAnalyzer ( @"ProjectFileAsAdditionalFile\ProjectFileAsAdditionalFile.csproj" , log ) ;
716
+
717
+ // When
718
+ IEnumerable < string > additionalFiles = analyzer . Build ( ) . First ( ) . AdditionalFiles ;
719
+
720
+ // Then
721
+ additionalFiles . ShouldBe ( new [ ] { "ProjectFileAsAdditionalFile.csproj" } , log . ToString ( ) ) ;
722
+ }
723
+
724
+ private static IProjectAnalyzer GetProjectAnalyzer ( string projectFile , StringWriter log )
725
+ {
726
+ IProjectAnalyzer analyzer = new AnalyzerManager (
727
+ new AnalyzerManagerOptions
728
+ {
729
+ LogWriter = log
730
+ } )
731
+ . GetProject ( GetProjectPath ( projectFile ) ) ;
711
732
712
733
private static IProjectAnalyzer GetProjectAnalyzer ( string projectFile , StringWriter log )
713
734
{
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+
3
+ <PropertyGroup >
4
+ <TargetFramework >net6.0</TargetFramework >
5
+ <ImplicitUsings >enable</ImplicitUsings >
6
+ <ImplicitUsings >disable</ImplicitUsings >
7
+ <Nullable >enable</Nullable >
8
+ <ProductName >Test project</ProductName >
9
+ </PropertyGroup >
10
+
11
+ <PropertyGroup >
12
+ <TargetFrameworks >net5.0;net6.0</TargetFrameworks >
13
+ <Nullable >annotations</Nullable >
14
+ </PropertyGroup >
15
+
16
+ <PropertyGroup Condition =" '1' == '1'" >
17
+ <ProductName >Test project</ProductName >
18
+ </PropertyGroup >
19
+
20
+ <ItemGroup >
21
+ <AdditionalFiles Include =" *.??proj" Visible =" false" />
22
+ </ItemGroup >
23
+
24
+ </Project >
Original file line number Diff line number Diff line change
1
+ namespace ProjectWithAdditionalFile ;
2
+
3
+ public class SomeClass { }
You can’t perform that action at this time.
0 commit comments