示例#1
0
        public override void OnException(MethodExecutionArgs args)
        {
            if (GlobalPackageSettings.ErrorReportingEnabled)
            {
                Raygun.LogException(args.Exception);
            }

            //rethrow the exception
            args.FlowBehavior = FlowBehavior.ThrowException;
        }
示例#2
0
        public void TryShootBugX()
        {
            Bug    bug = new Bug();
            Raygun gun = new Raygun();

            gun.FireAt(bug);

            Assert.True(bug.IsDead());
            Assert.True(gun.HasAmmo());
        }
        private async void buttonExport_Click(object sender, EventArgs e)
        {
            //Create Export Paramaters
            bool             excludePrivates         = radCheckBoxExcludePrivate.Checked;
            bool             ignoreDynamicProperties = _settings.IgnoreDynamicallyAddedProperties;
            ExportType       exportType       = GetExportType();
            int              maxDepth         = (int)numericUpDownMaxDepth.Value;
            ExportParamaters exportParamaters = new ExportParamaters(excludePrivates, ignoreDynamicProperties, maxDepth, exportType);

            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            _waitingDialog = new ProgressDialog(cancellationTokenSource);

            List <ExpressionWithSource> expressions = GetAllExpressions();

            if (expressions.Any())
            {
                //Hide and Show Progress Bar
                this.Hide();
                _waitingDialog.Show(this);

                TypeRetriever retriever       = new TypeRetriever(_dte2);
                var           exportGenerator = new ExportGenerator(expressions, retriever, exportParamaters);

                try
                {
                    Dictionary <string, string> lookupGeneratedTexts = await exportGenerator.GenerateTextWithKey(cancellationTokenSource.Token);

                    //Setup event for when the form is shown to close the waiting dialog
                    FormDisplayGeneratedText formDisplayGeneratedText = new FormDisplayGeneratedText(lookupGeneratedTexts, exportType);
                    formDisplayGeneratedText.Shown += formDisplayGeneratedText_Shown;
                    formDisplayGeneratedText.ShowDialog(this);
                }
                catch (ThreadAbortException ex)
                {
                    _waitingDialog.Close();
                }
                catch (ObjectDisposedException ex)
                {
                    _waitingDialog.Close();
                }
                catch (Exception ex)
                {
                    _waitingDialog.Close();
                    Raygun.LogException(ex);
                    MessageBox.Show("Error when attempting to export objects. If error reporting has not been disabled," +
                                    " then your error has already been logged.");
                }
                finally
                {
                    this.Show();
                }
            }
        }
        public void KillAlien()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            gun.Shoot(alien);

            // Assert
            Assert.True(alien.IsDead());
        }
        public void MissDodgingAlien()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            alien.Dodge();
            gun.Shoot(alien);

            // Assert
            Assert.False(alien.IsDead());
        }
        private void LoadUnmanagedLibraries()
        {
            string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            IntPtr pDll         = NativeMethods.LoadLibrary(Path.Combine(assemblyPath, "SciLexer.dll"));

            if (pDll == IntPtr.Zero)
            {
                Exception ex = new DllNotFoundException("Could not find SciLexer.dll - This is unmanaged assembly is required by ScintillaNet.dll");

                Raygun.LogException(ex);

                throw ex;
            }
        }
        public void ReloadAfterXShots(int shotsCount, bool shouldReload)
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            for (int i = 0; i < shotsCount; i++)
            {
                gun.Shoot(alien);
            }

            // Assert
            Assert.Equal(shouldReload, !gun.HasAmmo());
        }
示例#8
0
        public void TestBugDodges(bool didDodge, bool shouldBeDead)
        {
            Bug bug = new Bug ();
            Raygun gun = new Raygun ();

            if (didDodge) {
                bug.Dodge ();
            }

            gun.FireAt (bug);

            if (shouldBeDead) {
                Assert.True (bug.IsDead ());
            } else {
                Assert.False (bug.IsDead ());
            }
        }
        public void ReloadAfterShotWithNoAmmo()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            while (gun.HasAmmo())
            {
                gun.Shoot(alien);
            }

            gun.Shoot(alien);

            // Assert
            Assert.True(gun.HasAmmo());
        }
示例#10
0
        public void HaveAmmoAfterReload()
        {
            // Arrange
            var alien = new Alien();
            var gun   = new Raygun();

            // Act
            while (gun.HasAmmo())
            {
                gun.Shoot(alien);
            }

            gun.Reload();

            // Assert
            Assert.True(gun.HasAmmo());
        }
示例#11
0
 public void Initialize()
 {
     gun = new Raygun();
 }
示例#12
0
 public void Setup()
 {
     bug = new Bug();
     gun = new Raygun();
 }
示例#13
0
 public void Setup()
 {
     gun = new Raygun();
 }