public GetAzureRmMetricTests(Xunit.Abstractions.ITestOutputHelper output) { ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output)); insightsMetricOperationsMock = new Mock <IMetricsOperations>(); MonitorClientMock = new Mock <MonitorClient>(); commandRuntimeMock = new Mock <ICommandRuntime>(); cmdlet = new GetAzureRmMetricCommand() { CommandRuntime = commandRuntimeMock.Object, MonitorClient = MonitorClientMock.Object }; response = new Microsoft.Rest.Azure.AzureOperationResponse <IEnumerable <Metric> >() { Body = new List <Metric>() }; insightsMetricOperationsMock.Setup(f => f.ListWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <ODataQuery <Metric> >(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <Microsoft.Rest.Azure.AzureOperationResponse <IEnumerable <Metric> > >(response)) .Callback((string r, ODataQuery <Metric> s, Dictionary <string, List <string> > headers, CancellationToken t) => { resourceId = r; filter = s; }); MonitorClientMock.SetupGet(f => f.Metrics).Returns(this.insightsMetricOperationsMock.Object); }
public GetAzureRmMetricTests(Xunit.Abstractions.ITestOutputHelper output) { ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagement.Common.Models.XunitTracingInterceptor(output)); insightsMetricOperationsMock = new Mock <IMetricsOperations>(); MonitorClientMock = new Mock <MonitorManagementClient>() { CallBase = true }; commandRuntimeMock = new Mock <ICommandRuntime>(); cmdlet = new GetAzureRmMetricCommand() { CommandRuntime = commandRuntimeMock.Object, MonitorManagementClient = MonitorClientMock.Object }; response = new Microsoft.Rest.Azure.AzureOperationResponse <Response>(); insightsMetricOperationsMock.Setup(f => f.ListWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <ODataQuery <MetadataValue> >(), It.IsAny <string>(), It.IsAny <TimeSpan?>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int?>(), It.IsAny <string>(), It.IsAny <ResultType?>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <Microsoft.Rest.Azure.AzureOperationResponse <Response> >(response)) .Callback((string resourceUri, ODataQuery <MetadataValue> odataQuery, string timespan, TimeSpan? interval, string metricNames, string aggregation, int?top, string orderBy, ResultType? resultType, string metricNamespace, Dictionary <string, List <string> > headers, CancellationToken t) => { resourceId = resourceUri; filter = odataQuery; timeSpan = timespan; metricQueryInterval = interval; metricnames = metricNames; aggregationType = aggregation; topNumber = top; orderby = orderBy; resulttype = resultType; metricnamespace = metricNamespace; }); MonitorClientMock.SetupGet(f => f.Metrics).Returns(this.insightsMetricOperationsMock.Object); }
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); }