Skip to content

Commit 0c0b33e

Browse files
authored
Remove project reference of Azure.Generator.Tests.Common, copy it to mgmt generator instead to avoid the csproject dependency (Azure#51825)
1 parent 73ef526 commit 0c0b33e

18 files changed

+1457
-22
lines changed

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management.sln

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Generator.Management"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Generator.Mgmt.Tests", "Azure.Generator.Management\test\Azure.Generator.Mgmt.Tests.csproj", "{236F0049-E44C-40C9-90BB-BD19495CB689}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Generator.Tests.Common", "..\..\http-client-csharp\generator\Azure.Generator\test\common\Azure.Generator.Tests.Common.csproj", "{5C43C4D9-AC67-6643-B7AF-DF8096B8265A}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Generator.Management.Tests.Common", "Azure.Generator.Management\test\Common\Azure.Generator.Management.Tests.Common.csproj", "{611CC5AD-F05C-06D4-0613-809F36A61315}"
1111
EndProject
1212
Global
1313
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,14 +23,10 @@ Global
2323
{236F0049-E44C-40C9-90BB-BD19495CB689}.Debug|Any CPU.Build.0 = Debug|Any CPU
2424
{236F0049-E44C-40C9-90BB-BD19495CB689}.Release|Any CPU.ActiveCfg = Release|Any CPU
2525
{236F0049-E44C-40C9-90BB-BD19495CB689}.Release|Any CPU.Build.0 = Release|Any CPU
26-
{E6E6C66A-E1E2-4D4D-9E8A-FD97A1761F90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{E6E6C66A-E1E2-4D4D-9E8A-FD97A1761F90}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{E6E6C66A-E1E2-4D4D-9E8A-FD97A1761F90}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{E6E6C66A-E1E2-4D4D-9E8A-FD97A1761F90}.Release|Any CPU.Build.0 = Release|Any CPU
30-
{5C43C4D9-AC67-6643-B7AF-DF8096B8265A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31-
{5C43C4D9-AC67-6643-B7AF-DF8096B8265A}.Debug|Any CPU.Build.0 = Debug|Any CPU
32-
{5C43C4D9-AC67-6643-B7AF-DF8096B8265A}.Release|Any CPU.ActiveCfg = Release|Any CPU
33-
{5C43C4D9-AC67-6643-B7AF-DF8096B8265A}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{611CC5AD-F05C-06D4-0613-809F36A61315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{611CC5AD-F05C-06D4-0613-809F36A61315}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{611CC5AD-F05C-06D4-0613-809F36A61315}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{611CC5AD-F05C-06D4-0613-809F36A61315}.Release|Any CPU.Build.0 = Release|Any CPU
3430
EndGlobalSection
3531
GlobalSection(SolutionProperties) = preSolution
3632
HideSolutionNode = FALSE

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/test/Azure.Generator.Mgmt.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
<ItemGroup>
2727
<Compile Remove="**\TestData\**\*.cs" />
28+
<Compile Remove="Common\**" />
2829
</ItemGroup>
2930

3031
<ItemGroup>
31-
<ProjectReference Include="..\..\..\..\http-client-csharp\generator\Azure.Generator\test\common\Azure.Generator.Tests.Common.csproj" />
32-
<ProjectReference Include="..\src\Azure.Generator.Management.csproj" />
32+
<ProjectReference Include="Common\Azure.Generator.Management.Tests.Common.csproj" />
3333
</ItemGroup>
3434

3535
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsTestSupportProject>true</IsTestSupportProject>
8+
<!-- Don't warn for missing XML comments for test project. -->
9+
<NoWarn>$(NoWarn);1591</NoWarn>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="NUnit" />
14+
<PackageReference Include="NUnit3TestAdapter" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\..\src\Azure.Generator.Management.csproj" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using NUnit.Framework;
5+
6+
namespace Azure.Generator.Management.Tests.Common
7+
{
8+
public static class BinaryDataAssert
9+
{
10+
public static void AreEqual(BinaryData expected, BinaryData result)
11+
{
12+
CollectionAssert.AreEqual(expected?.ToArray(), result?.ToArray());
13+
}
14+
}
15+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Runtime.CompilerServices;
5+
6+
namespace Azure.Generator.Management.Tests.Common
7+
{
8+
/// <summary>
9+
/// Helper methods for Azure plugin tests
10+
/// </summary>
11+
public static class Helpers
12+
{
13+
/// <summary>
14+
/// Get expected content from file with naming convention
15+
/// </summary>
16+
/// <param name="parameters"></param>
17+
/// <param name="method"></param>
18+
/// <param name="filePath"></param>
19+
/// <returns></returns>
20+
public static string GetExpectedFromFile(
21+
string? parameters = null,
22+
[CallerMemberName] string method = "",
23+
[CallerFilePath] string filePath = "")
24+
{
25+
return File.ReadAllText(GetAssetFileOrDirectoryPath(true, parameters, method, filePath)).Replace("\r\n", "\n");
26+
}
27+
28+
private static string GetAssetFileOrDirectoryPath(
29+
bool isFile,
30+
string? parameters = null,
31+
[CallerMemberName] string method = "",
32+
[CallerFilePath] string filePath = "")
33+
{
34+
var callingClass = Path.GetFileName(filePath).Split('.').First();
35+
var paramString = parameters is null ? string.Empty : $"({parameters})";
36+
var extName = isFile ? ".cs" : string.Empty;
37+
38+
return Path.Combine(Path.GetDirectoryName(filePath)!, "TestData", callingClass, $"{method}{paramString}{extName}");
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)