public GetAzureRmAlertHistoryTests(ITestOutputHelper output) { TestExecutionHelpers.SetUpSessionAndProfile(); //XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); insightsEventOperationsMock = new Mock <IActivityLogsOperations>(); MonitorClientMock = new Mock <MonitorClient>(); commandRuntimeMock = new Mock <ICommandRuntime>(); cmdlet = new GetAzureRmAlertHistoryCommand() { CommandRuntime = commandRuntimeMock.Object, MonitorClient = MonitorClientMock.Object }; response = Test.Utilities.InitializeResponse(); finalResponse = Utilities.InitializeFinalResponse(); insightsEventOperationsMock.Setup(f => f.ListWithHttpMessagesAsync(It.IsAny <ODataQuery <EventData> >(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <AzureOperationResponse <IPage <EventData> > >(response)) .Callback((ODataQuery <EventData> f, string s, Dictionary <string, List <string> > headers, CancellationToken t) => { filter = f; selected = s; }); insightsEventOperationsMock.Setup(f => f.ListNextWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <AzureOperationResponse <IPage <EventData> > >(finalResponse)) .Callback((string next, Dictionary <string, List <string> > headers, CancellationToken t) => { nextLink = next; }); MonitorClientMock.SetupGet(f => f.ActivityLogs).Returns(this.insightsEventOperationsMock.Object); }
public GetAzureRmAlertHistoryTests() { insightsEventOperationsMock = new Mock <IEventOperations>(); insightsClientMock = new Mock <InsightsClient>(); commandRuntimeMock = new Mock <ICommandRuntime>(); cmdlet = new GetAzureRmAlertHistoryCommand() { CommandRuntime = commandRuntimeMock.Object, InsightsClient = insightsClientMock.Object }; response = Test.Utilities.InitializeResponse(); insightsEventOperationsMock.Setup(f => f.ListEventsAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <EventDataListResponse>(response)) .Callback((string f, string s, CancellationToken t) => { filter = f; selected = s; }); insightsClientMock.SetupGet(f => f.EventOperations).Returns(this.insightsEventOperationsMock.Object); }
public GetAzureRmAlertHistoryTests(ITestOutputHelper output) { //XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); insightsEventOperationsMock = new Mock <IEventsOperations>(); insightsClientMock = new Mock <InsightsClient>(); commandRuntimeMock = new Mock <ICommandRuntime>(); cmdlet = new GetAzureRmAlertHistoryCommand() { CommandRuntime = commandRuntimeMock.Object, InsightsClient = insightsClientMock.Object }; response = Test.Utilities.InitializeResponse(); insightsEventOperationsMock.Setup(f => f.ListWithHttpMessagesAsync(It.IsAny <ODataQuery <EventData> >(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult <AzureOperationResponse <IPage <EventData> > >(response)) .Callback((ODataQuery <EventData> f, string s, Dictionary <string, List <string> > headers, CancellationToken t) => { filter = f; selected = s; }); insightsClientMock.SetupGet(f => f.Events).Returns(this.insightsEventOperationsMock.Object); }