Skip to content

Commit ce105e1

Browse files
committed
Replay.
1 parent 7df378f commit ce105e1

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

tests/Buildalyzer.Tests/Integration/SimpleProjectsFixture.cs

+25-4
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,31 @@ public void GetsAdditionalFile()
704704
StringWriter log = new StringWriter();
705705
IProjectAnalyzer analyzer = GetProjectAnalyzer(@"ProjectWithAdditionalFile\ProjectWithAdditionalFile.csproj", log);
706706

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));
711732

712733
[Test]
713734
public void HandlesProcessFailure()
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)