public GetAzureRmMetricTests() { insightsMetricOperationsMock = new Mock<IMetricOperations>(); insightsClientMock = new Mock<InsightsClient>(); commandRuntimeMock = new Mock<ICommandRuntime>(); cmdlet = new GetAzureRmMetricCommand() { CommandRuntime = commandRuntimeMock.Object, InsightsClient = insightsClientMock.Object }; response = Utilities.InitializeMetricResponse(); insightsMetricOperationsMock.Setup(f => f.GetMetricsAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult<MetricListResponse>(response)) .Callback((string f, string s, CancellationToken t) => { resourceId = f; filter = s; }); insightsClientMock.SetupGet(f => f.MetricOperations).Returns(this.insightsMetricOperationsMock.Object); }
public GetAzureRmMetricTests(Xunit.Abstractions.ITestOutputHelper output) { ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output)); insightsMetricOperationsMock = new Mock<IMetricOperations>(); insightsClientMock = new Mock<InsightsClient>(); commandRuntimeMock = new Mock<ICommandRuntime>(); cmdlet = new GetAzureRmMetricCommand() { CommandRuntime = commandRuntimeMock.Object, //InsightsClient = insightsClientMock.Object }; response = Utilities.InitializeMetricResponse(); insightsMetricOperationsMock.Setup(f => f.GetMetricsAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult<MetricListResponse>(response)) .Callback((string f, string s, CancellationToken t) => { resourceId = f; filter = s; }); insightsClientMock.SetupGet(f => f.MetricOperations).Returns(this.insightsMetricOperationsMock.Object); }