Skip to content

Commit 82c6737

Browse files
authored
Workaround for issue 20444, ApiVersion not initialized. (Azure#20449)
1 parent ad7e18f commit 82c6737

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for
3+
// license information.
4+
5+
using System;
6+
//using Microsoft.Azure.Management.BotService.Customizations;
7+
//..using Microsoft.IdentityModel.Clients.ActiveDirectory;
8+
using Microsoft.Azure.Management.StorageCache;
9+
10+
namespace Microsoft.Azure.Management.StorageCache
11+
{
12+
using Microsoft.Rest;
13+
using Microsoft.Rest.Serialization;
14+
using Models;
15+
using Newtonsoft.Json;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Net;
19+
using System.Net.Http;
20+
21+
/// <summary>
22+
/// A Storage Cache provides scalable caching service for NAS clients,
23+
/// serving data from either NFSv3 or Blob at-rest storage (referred to as
24+
/// "Storage Targets"). These operations allow you to manage Caches.
25+
/// </summary>
26+
public partial class StorageCacheManagementClient : ServiceClient<StorageCacheManagementClient>, IStorageCacheManagementClient
27+
{
28+
29+
partial void CustomInitialize()
30+
{
31+
// Override the bot services operations with an augmented bot services operations,
32+
// which includes operations required to complete the provisioning of the bot
33+
this.ApiVersion = "2021-03-01";
34+
}
35+
}
36+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
namespace Microsoft.Azure.Management.StorageCache.Tests
5+
{
6+
using System.Collections.Generic;
7+
using Microsoft.Azure.Management.StorageCache.Models;
8+
using Microsoft.Azure.Management.StorageCache.Tests.Fixtures;
9+
using Microsoft.Azure.Management.StorageCache.Tests.Utilities;
10+
using Microsoft.Azure.Test.HttpRecorder;
11+
using Microsoft.Rest;
12+
using Xunit;
13+
using Xunit.Abstractions;
14+
15+
/// <summary>
16+
/// Defines the <see cref="CustomizationTests" />.
17+
/// </summary>
18+
[Collection("StorageCacheCollection")]
19+
public class CustomizationTests
20+
{
21+
/// <summary>
22+
/// Defines the testOutputHelper.
23+
/// </summary>
24+
private readonly ITestOutputHelper testOutputHelper;
25+
26+
/// <summary>
27+
/// Initializes a new instance of the <see cref="CustomizationTests"/> class.
28+
/// </summary>
29+
/// <param name="testOutputHelper">The testOutputHelper<see cref="ITestOutputHelper"/>.</param>
30+
public CustomizationTests(ITestOutputHelper testOutputHelper)
31+
{
32+
this.testOutputHelper = testOutputHelper;
33+
}
34+
35+
/// <summary>
36+
/// Verify the ApiVersion property of the client is default to the correct version."
37+
/// </summary>
38+
[Fact]
39+
public void TestApiVersion()
40+
{
41+
RecordedDelegatingHandler recordedDelegatingHandlers = new RecordedDelegatingHandler();
42+
ServiceClientCredentials credentials = new TokenCredentials("abc");
43+
StorageCacheManagementClient storageCacheManagementClient = new StorageCacheManagementClient(credentials, recordedDelegatingHandlers);
44+
Assert.Equal(Constants.DefaultAPIVersion, storageCacheManagementClient.ApiVersion);
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)