Skip to content

Commit 3d8f61a

Browse files
committed
Replay.
1 parent afe3d3b commit 3d8f61a

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs

+22-3
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,28 @@ public void GetsAdditionalFile()
709709
// When
710710
IEnumerable<string> additionalFiles = analyzer.Build().First().AdditionalFiles;
711711

712-
// Then
713-
additionalFiles.ShouldBe(new[] { "message.txt" }, log.ToString());
714-
}
712+
[Test]
713+
public void GetsProjectFileAsAdditionalFile()
714+
{
715+
// Given
716+
StringWriter log = new StringWriter();
717+
IProjectAnalyzer analyzer = GetProjectAnalyzer(@"ProjectFileAsAdditionalFile\ProjectFileAsAdditionalFile.csproj", log);
718+
719+
// When
720+
IEnumerable<string> additionalFiles = analyzer.Build().First().AdditionalFiles;
721+
722+
// Then
723+
additionalFiles.ShouldBe(new[] { "ProjectFileAsAdditionalFile.csproj" }, log.ToString());
724+
}
725+
726+
private static IProjectAnalyzer GetProjectAnalyzer(string projectFile, StringWriter log)
727+
{
728+
IProjectAnalyzer analyzer = new AnalyzerManager(
729+
new AnalyzerManagerOptions
730+
{
731+
LogWriter = log
732+
})
733+
.GetProject(GetProjectPath(projectFile));
715734

716735
private static IProjectAnalyzer GetProjectAnalyzer(string projectFile, StringWriter log)
717736
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
namespace ProjectWithAdditionalFile;
2+
3+
public class SomeClass { }

0 commit comments

Comments
 (0)