public void ReceiveTelemetryMessage_ExpectTelemetryMessageStored() { EventAggregatorMock eventAggregatorMock = new EventAggregatorMock(); eventAggregatorMock.AddPubSubEvent <TelemetryUpdateEvent, TelemetryUpdateEventArgs>(); IEventAggregator eventAggregator = eventAggregatorMock; ITelemetryReceiver telemetryReceiver = Substitute.For <ITelemetryReceiver>(); MainViewModel mainViewModel = new MainViewModel(eventAggregator, telemetryReceiver); ActivityLogViewModel activityLogViewModel = mainViewModel.ActivityLogViewModel; ReceivedTelemetryEventArgs eventArgs = new ReceivedTelemetryEventArgs( telemetryType: FAILURE_MESSAGE_TYPE, message: FAILURE_MESSAGE, sender: FAILURE_MESSAGE_SENDER, receiver: FAILURE_MESSAGE_RECEIVER, timestamp: DateTime.Now); mainViewModel.StartReceiveNotificationsCommand.Execute(); telemetryReceiver.NotificationReceived += Raise.EventWith(this, eventArgs); Assert.AreEqual(RECEIVE_MESSAGES_COUNT, activityLogViewModel.Activities.Count); Assert.AreEqual(FAILURE_MESSAGE_TYPE, activityLogViewModel.Activities.First().EventType); Assert.AreEqual(FAILURE_MESSAGE_SENDER, activityLogViewModel.Activities.First().Sender); Assert.AreEqual(FAILURE_MESSAGE, activityLogViewModel.Activities.First().Message); }
internal ServiceBundle( IHttpClientFactory httpClientFactory = null, IHttpManager httpManager = null, ITelemetryReceiver telemetryReceiver = null, IValidatedAuthoritiesCache validatedAuthoritiesCache = null, IAadInstanceDiscovery aadInstanceDiscovery = null, IWsTrustWebRequestManager wsTrustWebRequestManager = null, bool shouldClearCaches = false) { HttpManager = httpManager ?? new HttpManager(httpClientFactory); TelemetryManager = new TelemetryManager(telemetryReceiver ?? Telemetry.GetInstance()); ValidatedAuthoritiesCache = validatedAuthoritiesCache ?? new ValidatedAuthoritiesCache(shouldClearCaches); AadInstanceDiscovery = aadInstanceDiscovery ?? new AadInstanceDiscovery(HttpManager, TelemetryManager, shouldClearCaches); WsTrustWebRequestManager = wsTrustWebRequestManager ?? new WsTrustWebRequestManager(HttpManager); PlatformProxy = PlatformProxyFactory.GetPlatformProxy(); }
public static ServiceBundle CreateWithCustomHttpManager(IHttpManager httpManager, ITelemetryReceiver telemetryReceiver = null) { return(new ServiceBundle(httpManager: httpManager, telemetryReceiver: telemetryReceiver, shouldClearCaches: true)); }
public static ServiceBundle CreateDefault(ITelemetryReceiver telemetryReceiver = null) { return(new ServiceBundle(telemetryReceiver: telemetryReceiver)); }
public TelemetryManager(ITelemetryReceiver telemetryReceiver = null) { _telemetryReceiver = telemetryReceiver; }
public App(ILogger <App> logger, ITelemetryReceiver receiver, ITelemetryTransmitter transmitter) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _telemetryReceiver = receiver ?? throw new ArgumentNullException(nameof(receiver)); _telemetryTransmitter = transmitter ?? throw new ArgumentNullException(nameof(transmitter)); }