/// <summary>
        /// Calls the Overloaded GetThreatLevel Method of ErrorThreatService
        /// </summary>
        /// <param name="exceptione"></param>
        /// <returns>Level</returns>
        public AnalyzedError GetThreatLevel()
        {
            AnalyzedError Analysis      = new AnalyzedError(_e);
            var           ThreatService = new ErrorThreatService();

            Analysis.Lev = ThreatService.GetThreatLevel(_e);
            return(Analysis);
        }
Exemplo n.º 2
0
        public void TestMongoException()
        {
            //assign
            bool Answer;
            //act
            var Service = new ErrorThreatService();

            Answer = Service.GetThreatLevel(new MongoException("yeet")) == LogLevels.Levels.Warning;
            //assert
            Assert.IsTrue(Answer);
        }
Exemplo n.º 3
0
        public void TestMongoConfigurationException()
        {
            bool Answer;

            try
            {
                throw new MongoConfigurationException("f");
            }
            catch (Exception e)
            {
                ErrorThreatService Service = new ErrorThreatService();
                Answer = Service.GetThreatLevel(e) == LogLevels.Levels.Warning;
            }
            Assert.IsTrue(Answer);
        }
Exemplo n.º 4
0
        public void TestGeneralException()
        {
            bool Answer;
            var  Service = new ErrorThreatService();

            try
            {
                Answer = Service.GetThreatLevel(new Exception()) == LogLevels.Levels.Warning;
            }
            catch
            {
                throw;
            }
            Assert.IsTrue(Answer);
        }
        public void TestUnauthorizedAccessException()
        {
            var Lev = LogLevels.Levels.Debug;

            try
            {
                throw new UnauthorizedAccessException();
            }
            catch (UnauthorizedAccessException e)
            {
                var Service = new ErrorThreatService();
                Lev = Service.GetThreatLevel(e);
            }
            catch
            {
                throw;
            }

            Assert.AreEqual(Lev, LogLevels.Levels.Warning);
        }
        public void TestTimeoutException()
        {
            var Lev = LogLevels.Levels.Debug;

            try
            {
                throw new TimeoutException();
            }
            catch (TimeoutException e)
            {
                var Service = new ErrorThreatService();
                Lev = Service.GetThreatLevel(e);
            }
            catch
            {
                Assert.Fail();
            }

            Assert.AreEqual(Lev, LogLevels.Levels.Error);
        }
        public void TestHttpUnhandledException()
        {
            var Lev = LogLevels.Levels.Debug;

            try
            {
                throw new HttpUnhandledException();
            }
            catch (HttpUnhandledException e)
            {
                var Service = new ErrorThreatService();
                Lev = Service.GetThreatLevel(e);
            }
            catch
            {
                throw;
            }

            Assert.AreEqual(Lev, LogLevels.Levels.Warning);
        }
Exemplo n.º 8
0
        public void ErrorThreatServiceConstructorTest()
        {
            var Err = new ErrorThreatService();

            Assert.IsInstanceOfType(Err, typeof(ErrorThreatService));
        }