public void TestBugFilingTelemetrySpecificRule()
        {
            using (ShimsContext.Create())
            {
                SetUpShims();

                // Save telemetry locally
                List <Tuple <TelemetryAction, IReadOnlyDictionary <TelemetryProperty, string> > > telemetryLog = new List <Tuple <TelemetryAction, IReadOnlyDictionary <TelemetryProperty, string> > >();
                ShimLogger.PublishTelemetryEventTelemetryActionIReadOnlyDictionaryOfTelemetryPropertyString = (action, dict) =>
                {
                    telemetryLog.Add(new Tuple <TelemetryAction, IReadOnlyDictionary <TelemetryProperty, string> >(action, dict));
                };

                var bugInfo  = new BugInformation(ruleForTelemetry: RuleId.BoundingRectangleContainedInParent.ToString());
                var connInfo = new StubIConnectionInfo
                {
                    ServerUriGet = () => FAKE_SERVER_URL,
                };
                (int?bugId, string newBugId) = FileBugAction.FileNewBug(bugInfo,
                                                                        connInfo, false, 0, (_) => { });

                Assert.AreEqual(RuleId.BoundingRectangleContainedInParent.ToString(), telemetryLog[0].Item2[TelemetryProperty.RuleId]);
                Assert.AreEqual("", telemetryLog[0].Item2[TelemetryProperty.UIFramework]);
                Assert.AreEqual(2, telemetryLog[0].Item2.Count);
            }
        }
        public void FileNewBug_IsNotEnabled_ReturnsPlaceholder()
        {
            using (ShimsContext.Create())
            {
                ShimBugReporter.IsEnabledGet = () => false;
                var bugInfo  = new BugInformation();
                var connInfo = new StubIConnectionInfo();
                var output   = FileBugAction.FileNewBug(bugInfo,
                                                        connInfo, false, 0, (_) => { });

                Assert.IsNull(output.bugId);
                Assert.IsNotNull(output.newBugId);
                Assert.IsTrue(string.IsNullOrEmpty(output.newBugId));
            }
        }
        public void TestBugFilingTelemetryNoRule()
        {
            using (ShimsContext.Create())
            {
                SetUpShims();

                // Save telemetry locally
                List <Tuple <TelemetryAction, TelemetryProperty, string> > telemetryLog = new List <Tuple <TelemetryAction, TelemetryProperty, string> >();
                ShimLogger.PublishTelemetryEventTelemetryActionTelemetryPropertyString = (action, property, value) =>
                {
                    telemetryLog.Add(new Tuple <TelemetryAction, TelemetryProperty, string>(action, property, value));
                };

                var bugInfo  = new BugInformation();
                var connInfo = new StubIConnectionInfo
                {
                    ServerUriGet = () => FAKE_SERVER_URL,
                };
                (int?bugId, string newBugId) = FileBugAction.FileNewBug(bugInfo,
                                                                        connInfo, false, 0, (_) => { });

                Assert.AreEqual(0, telemetryLog.Count);
            }
        }