public GetAzureRmLogTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsEventOperationsMock = new Mock <IActivityLogsOperations>();
            MonitorClientMock           = new Mock <MonitorClient>();
            commandRuntimeMock          = new Mock <ICommandRuntime>();
            cmdlet = new GetAzureRmLogCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                MonitorClient  = MonitorClientMock.Object
            };

            response      = 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 GetAzureRmLogCommandTests()
        {
            insightsEventOperationsMock = new Mock <IEventOperations>();
            insightsClientMock          = new Mock <InsightsClient>();
            commandRuntimeMock          = new Mock <ICommandRuntime>();
            cmdlet = new GetAzureRmLogCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

            response = 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);
        }
Beispiel #3
0
        public GetAzureRmLogTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsEventOperationsMock = new Mock <IEventOperations>();
            insightsClientMock          = new Mock <InsightsClient>();
            commandRuntimeMock          = new Mock <ICommandRuntime>();
            cmdlet = new GetAzureRmLogCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsClient = insightsClientMock.Object
            };

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