Skip to content

Commit

Permalink
Remove circular shared source references in Azure.Core tests files (#…
Browse files Browse the repository at this point in the history
…38607)

* Initial reshuffle

* Second reshuffle

* nits

* fix
  • Loading branch information
annelo-msft authored Sep 12, 2023
1 parent e75845f commit 35ce212
Show file tree
Hide file tree
Showing 22 changed files with 14 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks);net47</TargetFrameworks>
<IncludeGeneratorSharedCode>true</IncludeGeneratorSharedCode>
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Azure.Core.TestFramework
{
internal class TestClientOptions : ClientOptions
public class TestClientOptions : ClientOptions
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@

<ItemGroup>
<ProjectReference Include="..\src\Azure.Core.TestFramework.csproj" />
<ProjectReference Include="..\..\..\resourcemanager\Azure.ResourceManager\src\Azure.ResourceManager.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Azure.Core\src\Shared\ForwardsClientCallsAttribute.cs" LinkBase="Shared\Core" />
<Compile Include="..\..\Azure.Core\src\Shared\PageResponseEnumerator.cs" LinkBase="Shared\Core" />
<Compile Include="..\..\Azure.Core\src\Shared\AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared\Core" />
<Compile Include="..\..\..\..\common\ManagementTestShared\Redesign\*.cs" LinkBase="Shared\Mgmt" />
<Compile Include="$(TestFrameworkSupportFiles)" LinkBase="Shared\TestFramework" />
</ItemGroup>

Expand Down
8 changes: 1 addition & 7 deletions sdk/core/Azure.Core/Azure.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Perf", "perf\Azu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{96E9F605-9C38-4D77-96F4-679EF8B9390F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager", "..\..\resourcemanager\Azure.ResourceManager\src\Azure.ResourceManager.csproj", "{8E60A748-3973-471A-B103-EC9406BB3313}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework.Tests", "..\Azure.Core.TestFramework\tests\Azure.Core.TestFramework.Tests.csproj", "{33C299B5-ABDA-47BC-838F-973E62C067F9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{13A04222-4F21-40FC-BE42-A37EE34FF272}"
Expand All @@ -53,7 +51,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Expressions.Data
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Tests.Public", "tests\public\Azure.Core.Tests.Public.csproj", "{BFBF8EF7-61D8-40E7-9E98-468A0427761E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Core.Tests.Common", "tests\common\Azure.Core.Tests.Common.csproj", "{0EEDF53F-120A-45B1-8468-A97A0D46DBAC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.Tests.Common", "tests\common\Azure.Core.Tests.Common.csproj", "{0EEDF53F-120A-45B1-8468-A97A0D46DBAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -113,10 +111,6 @@ Global
{96E9F605-9C38-4D77-96F4-679EF8B9390F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96E9F605-9C38-4D77-96F4-679EF8B9390F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96E9F605-9C38-4D77-96F4-679EF8B9390F}.Release|Any CPU.Build.0 = Release|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E60A748-3973-471A-B103-EC9406BB3313}.Release|Any CPU.Build.0 = Release|Any CPU
{33C299B5-ABDA-47BC-838F-973E62C067F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33C299B5-ABDA-47BC-838F-973E62C067F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33C299B5-ABDA-47BC-838F-973E62C067F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
2 changes: 0 additions & 2 deletions sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<ProjectReference Include="common\Azure.Core.Tests.Common.csproj" />
<ProjectReference Include="..\src\Azure.Core.csproj" />
<ProjectReference Include="..\..\Microsoft.Azure.Core.NewtonsoftJson\src\Microsoft.Azure.Core.NewtonsoftJson.csproj" />
<ProjectReference Include="..\..\..\resourcemanager\Azure.ResourceManager\src\Azure.ResourceManager.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\src\Shared\Multipart\*.cs" LinkBase="Shared\Multipart" />
Expand Down Expand Up @@ -75,7 +74,6 @@
<Compile Include="..\src\Shared\XmlWriterExtensions.cs" LinkBase="Shared" />
<Compile Include="..\..\Azure.Core.TestFramework\src\Instrumentation\ZeroPollingStrategy.cs" LinkBase="Shared\TestFramework" />
<Compile Include="$(TestFrameworkSupportFiles)" LinkBase="Shared\TestFramework" />
<Compile Include="..\..\..\..\common\ManagementTestShared\Redesign\*.cs" LinkBase="Shared\Mgmt" />
<Compile Remove="public/**" />
<Compile Remove="common/**" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions sdk/core/Azure.Core/tests/ResourceIdentifierTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using Azure.ResourceManager.Resources;
using NUnit.Framework;

namespace Azure.Core.Tests
Expand Down Expand Up @@ -779,7 +778,7 @@ public void VerifyRootResource()
{
var root = ResourceIdentifier.Root;
Assert.IsNull(root.Parent);
Assert.AreEqual(root.ResourceType, TenantResource.ResourceType.ToString());
Assert.AreEqual(root.ResourceType, "Microsoft.Resources/tenants");
Assert.AreEqual("/", root.ToString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="SessionRecords\FeatureCollectionTests\" />
<Folder Include="SessionRecords\LocationExpandedTests\" />
<Folder Include="SessionRecords\ResourceGroupOperationsTests\" />
<Folder Include="SessionRecords\RestApiCollectionTests\" />
<Folder Include="SessionRecords\SubscriptionOperationsTests\" />
<Compile Include="$(TestFrameworkSupportFiles)" LinkBase="Shared\TestFramework" />
<Compile Include="..\..\..\..\common\ManagementTestShared\Redesign\*.cs" LinkBase="Shared\Mgmt" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Azure.Core.Tests
{
#pragma warning disable SA1649 // File name should match first type name
internal class MockOperation<T> : Operation<T>, IOperation<T>
public class MockOperation<T> : Operation<T>, IOperation<T>
#pragma warning restore SA1649 // File name should match first type name
{
private static ClientDiagnostics _clientDiagnostics = new(new TestClientOptions());
Expand Down Expand Up @@ -121,16 +121,16 @@ public override Response UpdateStatus(CancellationToken cancellationToken = defa
return MockOperationInternal.UpdateStatus(cancellationToken);
}

public ValueTask<OperationState<T>> UpdateStateAsync(bool async, CancellationToken cancellationToken)
ValueTask<OperationState<T>> IOperation<T>.UpdateStateAsync(bool async, CancellationToken cancellationToken)
{
MockOperationInternal.UpdateStatusCallCount++;
MockOperationInternal.LastTokenReceivedByUpdateStatus = cancellationToken;

return new ValueTask<OperationState<T>>(OnUpdateState(cancellationToken));
}

public MockOperationInternal<T> MockOperationInternal { get; }
internal MockOperationInternal<T> MockOperationInternal { get; }

public Func<CancellationToken, OperationState<T>> OnUpdateState { get; set; }
internal Func<CancellationToken, OperationState<T>> OnUpdateState { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Azure.Core.TestFramework.Tests
{
internal class ManagementTestClient
public class ManagementTestClient
{
private readonly ClientDiagnostics _diagnostics;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
using Azure.Core.TestFramework;
using Azure.ResourceManager;
using Azure.ResourceManager.Resources;

namespace Azure.Core.TestFramework.Tests
{
internal class TestResourceCollection : ArmCollection, IEnumerable<TestResource>, IAsyncEnumerable<TestResource>
public class TestResourceCollection : ArmCollection, IEnumerable<TestResource>, IAsyncEnumerable<TestResource>
{
private DiagnosticScopeFactory _diagnostic = new DiagnosticScopeFactory("Azure.Clients", "Microsoft.Azure.Core.Cool.Tests", true, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core.Pipeline;
using Azure.Core.Tests;
using Azure.ResourceManager;

namespace Azure.Core.TestFramework
{
internal class TestResource : ArmResource
public class TestResource : ArmResource
{
private DiagnosticScopeFactory _diagnostic = new DiagnosticScopeFactory("Azure.Clients", "Microsoft.Azure.Core.Cool.Tests", true, false);
private static MockResponse mockResponse = new(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Azure.Core.TestFramework
{
internal class TestResourceOperation : Operation<TestResource>, IOperationSource<TestResource>
public class TestResourceOperation : Operation<TestResource>, IOperationSource<TestResource>
{
private TestResource _value;
private bool _exceptionOnWait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Azure.Core.TestFramework
{
internal enum UpdateResult
public enum UpdateResult
{
Pending,
Failure,
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 35ce212

Please sign in to comment.