Skip to content

Commit

Permalink
Workaround for issue 20444, ApiVersion not initialized. (Azure#20449)
Browse files Browse the repository at this point in the history
  • Loading branch information
brpanask authored Apr 16, 2021
1 parent ad7e18f commit 82c6737
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
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";
}
}
}
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);
}
}
}

0 comments on commit 82c6737

Please sign in to comment.