diff --git a/tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs b/tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs index 81cd2cfe..ccc3713c 100644 --- a/tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs +++ b/tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs @@ -704,10 +704,31 @@ public void GetsAdditionalFile() StringWriter log = new StringWriter(); IProjectAnalyzer analyzer = GetProjectAnalyzer(@"ProjectWithAdditionalFile\ProjectWithAdditionalFile.csproj", log); - // When + then - analyzer.Build().First().AdditionalFiles.Select(Path.GetFileName) - .Should().BeEquivalentTo("message.txt"); - } + // When + IEnumerable additionalFiles = analyzer.Build().First().AdditionalFiles; + + [Test] + public void GetsProjectFileAsAdditionalFile() + { + // Given + StringWriter log = new StringWriter(); + IProjectAnalyzer analyzer = GetProjectAnalyzer(@"ProjectFileAsAdditionalFile\ProjectFileAsAdditionalFile.csproj", log); + + // When + IEnumerable additionalFiles = analyzer.Build().First().AdditionalFiles; + + // Then + additionalFiles.ShouldBe(new[] { "ProjectFileAsAdditionalFile.csproj" }, log.ToString()); + } + + private static IProjectAnalyzer GetProjectAnalyzer(string projectFile, StringWriter log) + { + IProjectAnalyzer analyzer = new AnalyzerManager( + new AnalyzerManagerOptions + { + LogWriter = log + }) + .GetProject(GetProjectPath(projectFile)); [Test] public void HandlesProcessFailure() diff --git a/tests/projects/ProjectFileAsAdditionalFile/ProjectFileAsAdditionalFile.csproj b/tests/projects/ProjectFileAsAdditionalFile/ProjectFileAsAdditionalFile.csproj new file mode 100644 index 00000000..be3e0013 --- /dev/null +++ b/tests/projects/ProjectFileAsAdditionalFile/ProjectFileAsAdditionalFile.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + disable + enable + Test project + + + + net5.0;net6.0 + annotations + + + + Test project + + + + + + + diff --git a/tests/projects/ProjectFileAsAdditionalFile/SomeClass.cs b/tests/projects/ProjectFileAsAdditionalFile/SomeClass.cs new file mode 100644 index 00000000..775fdb94 --- /dev/null +++ b/tests/projects/ProjectFileAsAdditionalFile/SomeClass.cs @@ -0,0 +1,3 @@ +namespace ProjectWithAdditionalFile; + +public class SomeClass { }