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); }