コード例 #1
0
        /// <summary>
        /// calls method To create responseservices depending on type of exception and level of severity, and then executes them
        /// </summary>
        /// <param name="e"></param>
        /// <param name="level"></param>
        public AnalyzedError GetResponse(AnalyzedError Err)
        {
            IErrorResponseService ResponseService;

            if (Err.Lev == LogLevels.Levels.Fatal)
            {
                ResponseService = new FatalResponseService(Err);
            }
            else if (Err.Lev == LogLevels.Levels.Error)
            {
                ResponseService = new ErrorResponseService(Err);
            }
            else
            {
                ResponseService = new WarningResponseService(Err);
            }
            try
            {
                LogService.Log(Err.ToString());
            }
            catch (Exception caught)
            {
                var Failure = new FatalResponseService(new AnalyzedError(caught)
                {
                    Lev = LogLevels.Levels.Fatal
                });
                Failure.GetResponse();
            }

            return(ResponseService.GetResponse());
        }
コード例 #2
0
        public void FatalResponseServiceConstructorTest()
        {
            var Err = new FatalResponseService(new AnalyzedError(new Exception()));

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