public void DummyDisposableEvents() { //Modify preferences dynamoSettings.IsAnalyticsReportingApproved = false; var variable = "TimeVariable"; var description = "Some description"; var e = Analytics.CreateTimedEvent(Categories.Performance, variable, description); Assert.IsNotInstanceOf <TimedEvent>(e); e.Dispose(); //1 ApplicationLifecycle Start trackerMoq.Verify(t => t.Track(It.IsAny <TimedEvent>(), factoryMoq.Object), Times.Exactly(1)); e = Analytics.TrackCommandEvent("TestCommand"); Assert.IsNotInstanceOf <CommandEvent>(e); e.Dispose(); trackerMoq.Verify(t => t.Track(It.IsAny <CommandEvent>(), factoryMoq.Object), Times.Never()); e = Analytics.TrackFileOperationEvent(this.TempFolder, Actions.Save, 5); Assert.IsNotInstanceOf <FileOperationEvent>(e); e.Dispose(); trackerMoq.Verify(t => t.Track(It.IsAny <FileOperationEvent>(), factoryMoq.Object), Times.Never()); //Reset preferences dynamoSettings.IsAnalyticsReportingApproved = true; }
protected virtual void VerifyEventTracking(Times times) { Analytics.TrackEvent(Actions.New, Categories.NodeOperations, "New Node", 5); clientMoq.Verify(c => c.TrackEvent(Actions.New, Categories.NodeOperations, "New Node", 5), times); Analytics.TrackScreenView("TestScreen"); clientMoq.Verify(c => c.TrackScreenView("TestScreen"), times); TestAnalytics.TrackException <InvalidOperationException>(false); clientMoq.Verify(c => c.TrackException(It.IsAny <InvalidOperationException>(), false), times); var time = TimeSpan.FromMinutes(3); var variable = "TimeVariable"; var description = "Some description"; Analytics.TrackTimedEvent(Categories.Stability, variable, time, description); clientMoq.Verify(c => c.TrackTimedEvent(Categories.Stability, variable, time, description), times); using (var x = Analytics.CreateTimedEvent(Categories.Performance, variable, description)) { clientMoq.Verify(c => c.CreateTimedEvent(Categories.Performance, variable, description, null), times); } var e = Analytics.TrackCommandEvent("TestCommand"); clientMoq.Verify(c => c.CreateCommandEvent("TestCommand", "", null), times); e = Analytics.TrackFileOperationEvent(this.TempFolder, Actions.Read, 5); clientMoq.Verify(c => c.TrackFileOperationEvent(this.TempFolder, Actions.Read, 5, ""), times); Analytics.LogPiiInfo("tag", "data"); clientMoq.Verify(c => c.LogPiiInfo("tag", "data"), times); }
public void CreateDisposableEvents() { var variable = "TimeVariable"; var description = "Some description"; var e = Analytics.CreateTimedEvent(Categories.Performance, variable, description); Assert.IsInstanceOf <TimedEvent>(e); e.Dispose(); //1 Dispose, Timed event is not tracked for creation. trackerMoq.Verify(t => t.Track(e as TimedEvent, factoryMoq.Object), Times.Exactly(1)); e = Analytics.TrackCommandEvent("TestCommand"); Assert.IsInstanceOf <CommandEvent>(e); e.Dispose(); //1 Create + 1 Dispose trackerMoq.Verify(t => t.Track(e as CommandEvent, factoryMoq.Object), Times.Exactly(2)); e = Analytics.TrackFileOperationEvent(this.TempFolder, Actions.Save, 5); Assert.IsInstanceOf <FileOperationEvent>(e); e.Dispose(); //1 Create + 1 Dispose trackerMoq.Verify(t => t.Track(e as FileOperationEvent, factoryMoq.Object), Times.Exactly(2)); }