forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround for issue 20444, ApiVersion not initialized. (Azure#20449)
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...icrosoft.Azure.Management.StorageCache/src/Customizations/StorageCacheManagementClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for | ||
// license information. | ||
|
||
using System; | ||
//using Microsoft.Azure.Management.BotService.Customizations; | ||
//..using Microsoft.IdentityModel.Clients.ActiveDirectory; | ||
using Microsoft.Azure.Management.StorageCache; | ||
|
||
namespace Microsoft.Azure.Management.StorageCache | ||
{ | ||
using Microsoft.Rest; | ||
using Microsoft.Rest.Serialization; | ||
using Models; | ||
using Newtonsoft.Json; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using System.Net.Http; | ||
|
||
/// <summary> | ||
/// A Storage Cache provides scalable caching service for NAS clients, | ||
/// serving data from either NFSv3 or Blob at-rest storage (referred to as | ||
/// "Storage Targets"). These operations allow you to manage Caches. | ||
/// </summary> | ||
public partial class StorageCacheManagementClient : ServiceClient<StorageCacheManagementClient>, IStorageCacheManagementClient | ||
{ | ||
|
||
partial void CustomInitialize() | ||
{ | ||
// Override the bot services operations with an augmented bot services operations, | ||
// which includes operations required to complete the provisioning of the bot | ||
this.ApiVersion = "2021-03-01"; | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
sdk/storagecache/Microsoft.Azure.Management.StorageCache/tests/CustomizationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Microsoft.Azure.Management.StorageCache.Tests | ||
{ | ||
using System.Collections.Generic; | ||
using Microsoft.Azure.Management.StorageCache.Models; | ||
using Microsoft.Azure.Management.StorageCache.Tests.Fixtures; | ||
using Microsoft.Azure.Management.StorageCache.Tests.Utilities; | ||
using Microsoft.Azure.Test.HttpRecorder; | ||
using Microsoft.Rest; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
/// <summary> | ||
/// Defines the <see cref="CustomizationTests" />. | ||
/// </summary> | ||
[Collection("StorageCacheCollection")] | ||
public class CustomizationTests | ||
{ | ||
/// <summary> | ||
/// Defines the testOutputHelper. | ||
/// </summary> | ||
private readonly ITestOutputHelper testOutputHelper; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CustomizationTests"/> class. | ||
/// </summary> | ||
/// <param name="testOutputHelper">The testOutputHelper<see cref="ITestOutputHelper"/>.</param> | ||
public CustomizationTests(ITestOutputHelper testOutputHelper) | ||
{ | ||
this.testOutputHelper = testOutputHelper; | ||
} | ||
|
||
/// <summary> | ||
/// Verify the ApiVersion property of the client is default to the correct version." | ||
/// </summary> | ||
[Fact] | ||
public void TestApiVersion() | ||
{ | ||
RecordedDelegatingHandler recordedDelegatingHandlers = new RecordedDelegatingHandler(); | ||
ServiceClientCredentials credentials = new TokenCredentials("abc"); | ||
StorageCacheManagementClient storageCacheManagementClient = new StorageCacheManagementClient(credentials, recordedDelegatingHandlers); | ||
Assert.Equal(Constants.DefaultAPIVersion, storageCacheManagementClient.ApiVersion); | ||
} | ||
} | ||
} |