public GetUsageMetricsCommandTests() { insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>(); insightsClientMock = new Mock<InsightsClient>(); commandRuntimeMock = new Mock<ICommandRuntime>(); cmdlet = new GetUsageMetricsCommand() { CommandRuntime = commandRuntimeMock.Object, InsightsClient = insightsClientMock.Object }; response = Utilities.InitializeUsageMetricResponse(); insightsUsageMetricOperationsMock .Setup(f => f.ListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult<UsageMetricListResponse>(response)) .Callback((string f, string s, string a, CancellationToken t) => { resourceId = f; filter = s; apiVersion = a; }); insightsClientMock .SetupGet(f => f.UsageMetricOperations) .Returns(this.insightsUsageMetricOperationsMock.Object); }
public GetAzureRmUsageTests(Xunit.Abstractions.ITestOutputHelper output) { ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output)); insightsUsageMetricOperationsMock = new Mock<IUsageMetricsOperations>(); insightsClientMock = new Mock<InsightsClient>(); commandRuntimeMock = new Mock<ICommandRuntime>(); cmdlet = new GetAzureRmUsageCommand() { CommandRuntime = commandRuntimeMock.Object, InsightsClient = insightsClientMock.Object }; response = Utilities.InitializeUsageMetricResponse(); insightsUsageMetricOperationsMock .Setup(f => f.ListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult<UsageMetricListResponse>(response)) .Callback((string f, string s, string a, CancellationToken t) => { resourceId = f; filter = s; apiVersion = a; }); insightsClientMock .SetupGet(f => f.UsageMetricOperations) .Returns(this.insightsUsageMetricOperationsMock.Object); }