Example #1
0
        public void DeleteAContextThatDoesntExist()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);

            plugInControl.ReleaseContext(context);
            plugInControl.ReleaseContext(context); // Should just fail quietly.
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #2
0
        public void GetContextDefaultSettings()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));


            // Get the default settings.
            NameValueCollection defaultSettings = context.Properties;

            Assert.AreNotEqual(null, defaultSettings);

            Assert.AreEqual(true, defaultSettings.AllKeys.Contains("LogVerbose"));
            Assert.AreEqual("0", defaultSettings["LogVerbose"]);

            Assert.AreEqual(true, defaultSettings.AllKeys.Contains("EnableContext"));
            Assert.AreEqual("1", defaultSettings["EnableContext"]);


            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #3
0
        public void ScriptResultsAddedNullScriptData()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));

            BugTrackerProduct product  = new BugTrackerProduct("StackHash", "1.2.3.4", 1234568);
            BugTrackerFile    file     = new BugTrackerFile("StackHash.dll", "1.2.3.4", 234567);
            BugTrackerEvent   theEvent = new BugTrackerEvent("Reference", "Plugin bug ref", 1111111, "CLR20 - Crash", 122, new NameValueCollection());

            theEvent.Signature["Exception"] = "0x23434";
            BugTrackerCab cab = new BugTrackerCab(12243, 12121, false, true, new NameValueCollection(), "c:\\test\\my.cab");

            cab.AnalysisData["New1"] = "Data1";
            cab.AnalysisData["New2"] = "Data2";

            BugTrackerScriptResult result = new BugTrackerScriptResult("ScriptName", 1, DateTime.Now, DateTime.Now, null);

            context.DebugScriptExecuted(BugTrackerReportType.Automatic, product, file, theEvent, cab, result);

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #4
0
        public void AddManyContextsAndRelease()
        {
            int numContextsToCreate = 10;

            List <IBugTrackerV1Context> allContexts = new List <IBugTrackerV1Context>();

            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);


            for (int i = 0; i < numContextsToCreate; i++)
            {
                IBugTrackerV1Context context = plugInControl.CreateContext();
                Assert.AreNotEqual(null, context);

                allContexts.Add(context);
                Assert.AreEqual(i + 1, GetNumberOfActiveProfiles(plugInControl));
            }

            foreach (IBugTrackerV1Context context in allContexts)
            {
                plugInControl.ReleaseContext(context);
                numContextsToCreate--;
                Assert.AreEqual(numContextsToCreate, GetNumberOfActiveProfiles(plugInControl));
            }
        }
Example #5
0
        public void CreateOneContext()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #6
0
        public void ProductUpdated()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));

            BugTrackerProduct product = new BugTrackerProduct("StackHash", "1.2.3.4", 1234568);

            context.ProductUpdated(BugTrackerReportType.Automatic, product);

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #7
0
        public void EventAddedNoEventSignature()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));

            BugTrackerProduct product  = new BugTrackerProduct("StackHash", "1.2.3.4", 1234568);
            BugTrackerFile    file     = new BugTrackerFile("StackHash.dll", "1.2.3.4", 234567);
            BugTrackerEvent   theEvent = new BugTrackerEvent("Reference", "Plugin bug ref", 1111111, "CLR20 - Crash", 122, new NameValueCollection());

            context.EventAdded(BugTrackerReportType.Automatic, product, file, theEvent);

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #8
0
        public void GetContextDiagnostics()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));


            NameValueCollection diagnostics = context.ContextDiagnostics;

            Assert.AreNotEqual(null, diagnostics);

            Assert.AreEqual(true, diagnostics.AllKeys.Contains("LastException"));
            Assert.AreEqual("No Error", diagnostics["LastException"]);

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }
Example #9
0
        public void EventNoteAdded()
        {
            IBugTrackerV1Control plugInControl = new FaultDatabaseControl();

            Assert.AreNotEqual(null, plugInControl);

            IBugTrackerV1Context context = plugInControl.CreateContext();

            Assert.AreNotEqual(null, context);
            Assert.AreEqual(1, GetNumberOfActiveProfiles(plugInControl));

            BugTrackerProduct product  = new BugTrackerProduct("StackHash", "1.2.3.4", 1234568);
            BugTrackerFile    file     = new BugTrackerFile("StackHash.dll", "1.2.3.4", 234567);
            BugTrackerEvent   theEvent = new BugTrackerEvent("Reference", "Plugin bug ref", 1111111, "CLR20 - Crash", 122, new NameValueCollection());

            theEvent.Signature["Exception"] = "0x23434";
            BugTrackerNote note = new BugTrackerNote(DateTime.Now, "Source", "MarkJ", "Hello from me");

            context.EventNoteAdded(BugTrackerReportType.Automatic, product, file, theEvent, note);

            plugInControl.ReleaseContext(context);
            Assert.AreEqual(0, GetNumberOfActiveProfiles(plugInControl));
        }