Example #1
0
        public void Start()
        {
            try
            {
                retries = int.Parse(ConfigurationManager.AppSettings["Retries"]);
                logger = LogManager.CreateLogger("Custom.LoggingWrapper.LogManager");

            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return;
            }
            try
            {
                logger.Log(Level.DEBUG, "Starting Ignite Scheduled Email Creator...");

                is_running = true;
                // Note that there are two threads doing the processing. one for registration and one for sos calls
                callsListener = new Thread(Listen);
                callsListener.Start();

                //   expiryDateChecker.Start();
                logger.Log(Level.DEBUG, "Ignite Scheduled Email Creator : started");
            }
            catch (Exception ex)
            {
                logger.Log(Level.ERROR, ex.ToString());
                Stop();
            }
        }
Example #2
0
        public MainForm()
        {
            InitializeComponent();
            //general
            this.button1.Tag = false;
            this.button1.Enabled = false;
            this.pboxVoiceStatus.Image = this.imageListVoiceStatus.Images[1];
            this.label2.Text = "";
            this.lblServerStatus.Text = "Disconneted";
            this.tsddbSettings.AutoToolTip = false;
            this._logger = new Logger(this.tbLog);

            DataSet ds = new DataSet();
            string s_file = "MessagesDB.xml";
            try
            {
                _logger.Log(String.Format("Loading XML Data file: {0}...", s_file));
                ds.ReadXml(s_file);
                _logger.Log("XML Data file file loaded successfuly");
            }
            catch (Exception e)
            {
                _logger.Log(String.Format("Error in shcema loading: {0}. skipping.", e.Message));
            }

            grammer_completed_handler = new EventHandler<LoadGrammarCompletedEventArgs>(this.recognizer_LoadGrammarCompleted);
        }
        public TransvoxelManager(GraphicsDevice gd)
        {
            _gd = gd;
            _logger = Logger.GetLogger();
            _chunks = new ConcurrentDictionary<Vector3, Chunk>();

            // Initialize Transvoxel
            _logSend = "TransvoxelManager";
            _logger.Log(_logSend, "Creating Octree");
            _volumeData = new HashedVolume<sbyte>();
            _logger.Log(_logSend, "Creating TransvoxelExtractor");
            _surfaceExtractor = new TransvoxelExtractor(_volumeData);
        }
Example #4
0
        static void Main(string[] args)
        {
            BaseLogger logger = new Logger();
            //Log started
            logger.Log("Log started");
            //Base: Log Continuing
            logger.Log("Base: Log Continuing");
            //((BaseLogger)logger).Log("Log Continuing"); //=> Just prints: Log Continuing
            //Finished
            //logger.LogCompleted(); // => Completed
            ((Logger)logger).LogCompleted();

            Console.ReadKey();
        }
Example #5
0
        public void Execute()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "BMP (*.BMP)|*.BMP|JPEG (*.JPEG; *.JPG)|*.JPEG;*.JPG|All files (*.*)|*.*";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    Bitmap openedBitmap = (Bitmap)Bitmap.FromFile(openFileDialog.FileName);

                    _drawingFeatures.PaintingArea.Image = ConvertIndexedBitmapToNonIndexed(openedBitmap);

                    _drawingFeatures.Graphics = Graphics.FromImage(_drawingFeatures.PaintingArea.Image);
                }
                catch(Exception e)
                {
                    _drawingFeatures.PaintingArea.Image = new Bitmap(1000, 1000);
                    _drawingFeatures.Graphics = Graphics.FromImage(_drawingFeatures.PaintingArea.Image);

                    MessageBox.Show("Could not open the file");

                    Logger logger = new Logger();
                    logger.Log(e);
                }
                finally
                {
                    _drawingFeatures.DrawingHistory = new DrawingHistory();
                }
            }
        }
Example #6
0
        public void CanLogMessage()
        {
            // Arrange
            var id = _fixture.Create<int>().ToString(CultureInfo.InvariantCulture);
            var logId = _fixture.Create<Guid>();
            Uri actualUri = null;
            string actualData = null;

            var requestHeaders = new WebHeaderCollection();
            var webClientMock = new Mock<IWebClient>();
            webClientMock
                .Setup(x => x.Post(It.IsAny<WebHeaderCollection>(), It.IsAny<Uri>(), It.IsAny<string>(), It.IsAny<Func<WebHeaderCollection, string, string>>()))
                .Callback<WebHeaderCollection, Uri, string, Func<WebHeaderCollection, string, string>>((headers, uri, data, resultor) => { requestHeaders = headers; actualUri = uri; actualData = data; })
                .Returns(Task.FromResult("https://elmah.io/api/v2/messages?id=" + id + "&logid=" + logId));

            var logger = new Logger(logId, null, webClientMock.Object);
            var message = _fixture.Create<Message>();

            // Act
            var result = logger.Log(message);

            // Assert
            Assert.That(result, Is.EqualTo(id));
            Assert.That(requestHeaders[HttpRequestHeader.ContentType], Is.EqualTo("application/json"));
            Assert.That(actualUri.AbsoluteUri, Is.Not.Null.And.StringEnding(string.Format("api/v2/messages?logId={0}", logId)));
            Assert.That(actualData, Is.Not.Null);
            Assert.That(actualData, Is.StringContaining(message.Title));
            Assert.That(actualData, Is.StringContaining(message.Severity.ToString()));
        }
Example #7
0
        public async Task Test()
        {
            var logger = new Logger(new ConsoleLogObserver(), new DefaultDateTimeProvider());

            var consumers = new Dictionary<MessageQueue, Action<BasicDeliverEventArgs>>()
            {
                {
                    new MessageQueue("test"),
                    args =>
                    {
                        var body = args.Body;
                        var msg = Encoding.UTF8.GetString(body, 0, body.Length);
                        logger.Log("Received", new {msg});
                    }
                }
            };

            var connectionFactory = new ConnectionFactory() { HostName = "amqp://localhost/" };
            var provider = new RabbitMqService(connectionFactory, logger);
            var cts = new CancellationTokenSource();

            await provider.ConnectAsync(consumers, cts.Token, logger);

            await provider.Send(new SendingMessage(new PublicationAddress("d", "test", ""), Encoding.UTF8.GetBytes("Hi! Test!")));
            var tcs = new TaskCompletionSource<object>();

            await tcs.Task;
        }
Example #8
0
        static void Main(string[] args)
        {
            string initpath = "./";
            string outpath = "../bin/script02.CSLEDll.bytes";

            var logger = new Logger();

            ScriptEnv.Instance.Reset(logger);
            logger.Log_Warn("Begin Script Test.");

            string scriptpath = System.IO.Path.GetFullPath(initpath);//需要修改

            logger.Log("ScriptPath=" + scriptpath);
            logger.Log_Warn("Please Check if the path is correct.Press any key to continue.");

            logger.Pause();

            string[] filelist = System.IO.Directory.GetFiles(scriptpath, "*.cs", System.IO.SearchOption.AllDirectories);
            logger.Log_Warn("got code file:" + filelist.Length);
            logger.Log_Warn("BeginTokenParse");
            Dictionary<string, IList<CSLE.Token>> project = new Dictionary<string, IList<CSLE.Token>>();
            foreach (var f in filelist)
            {
                string code = System.IO.File.ReadAllText(f);
                var tokens = ScriptEnv.Instance.scriptEnv.tokenParser.Parse(code);
                var filename = System.IO.Path.GetFileName(f);
                project[filename] = tokens;
                logger.Log("TokenParse:" + filename + " len:" + code.Length + " token:" + tokens.Count);
            }
            logger.Log_Warn("TokenParser Finish.");
            logger.Log_Warn("BeginCompile");
            ScriptEnv.Instance.scriptEnv.Project_Compiler(project, true);
            logger.Log_Warn("EndCompile");


            using (System.IO.Stream s = System.IO.File.Open(outpath, System.IO.FileMode.Create))
            {
                ScriptEnv.Instance.scriptEnv.Project_PacketToStream(project, s);
            }
            logger.Log("Write script.CSLEDll.bytes in:" + outpath);


            logger.Log_Warn("Test end.Press any key to exit.");
            logger.Pause();

        }
Example #9
0
        public ADrawable CreateADrawableObject(IDrawingFeatures drawingFeatures, Point startPoint)
        {
            switch (drawingFeatures.DrawingState)
            {
                case DrawingState.DrawCircle:
                    {
                        ADrawable draw = new CircleDrawer(drawingFeatures, startPoint);

                        return draw;
                    }
                case DrawingState.DrawRectangle:
                    {
                        ADrawable draw = new RectangleDrawer(drawingFeatures, startPoint);

                        return draw;
                    }
                case DrawingState.DrawFilledCircle:
                    {
                        ADrawable draw = new FillCircleDrawer(drawingFeatures, startPoint);

                        return draw;
                    }
                case DrawingState.DrawFilledRectangle:
                    {
                        ADrawable draw = new FillRectangleDrawer(drawingFeatures, startPoint);

                        return draw;
                    }
                case DrawingState.DrawLine:
                    {
                        ADrawable draw = new LineDrawer(drawingFeatures, startPoint);

                        return draw;
                    }
                case DrawingState.DrawPencil:
                    {
                        ADrawable draw = new PencilDrawer(drawingFeatures);

                        return draw;
                    }
                case DrawingState.FloodFill:
                    {
                        ADrawable draw = new FloodFill(drawingFeatures, startPoint);

                        return draw;
                    }
                default:
                    {
                        ADrawable draw = new NullDrawer();

                        Logger logger = new Logger();
                        logger.Log(new ArgumentException("DrawableFactory - Drawing State: "+drawingFeatures.DrawingState.ToString()));

                        return draw;
                    }
            }
        }
        public IMenuCommand CreateIMenuCommnadObject(IDrawingFeatures drawingFeatures, string menuCommandName)
        {
            switch (menuCommandName)
            {
                case "New":
                    {
                        IMenuCommand menuCommnad = new NewCommand(drawingFeatures);

                        return menuCommnad;
                    }
                case "Open":
                    {
                        IMenuCommand menuCommnad = new OpenCommand(drawingFeatures);

                        return menuCommnad;
                    }
                case "Save":
                    {
                        IMenuCommand menuCommnad = new SaveCommand(drawingFeatures);

                        return menuCommnad;
                    }
                case "Undo":
                    {
                        IMenuCommand menuCommnad = new UndoCommand(drawingFeatures);

                        return menuCommnad;
                    }
                case "Redo":
                    {
                        IMenuCommand menuCommnad = new RedoCommand(drawingFeatures);

                        return menuCommnad;
                    }
                case "Resize":
                    {
                        IMenuCommand menuCommnad = new ResizePaintingAreaCommand(drawingFeatures);

                        return menuCommnad;
                    }
                default:
                    {
                        IMenuCommand menuCommnad = new NullMenuCommand();

                        Logger logger = new Logger();
                        logger.Log(new ArgumentException("MenuCommandFactory - MenuCommandName: " + menuCommandName));

                        return menuCommnad;
                    }
            }
        }
Example #11
0
        /// <summary>
        /// parset planetinformationen
        /// </summary>
        /// <param name="planetNode">Html Knoten, der die Planetinformationen enthält</param>
        public Planet(HtmlAgilityPack.HtmlNode planetNode, StringManager strings, Logger logger)
        {
            logger.Log (LoggingCategories.Parse, "Planet Constructor");
            this._name = planetNode.SelectSingleNode (strings.PlanetNameXPath).InnerText;

            //Koordinaten auslesen:
            string coordsString = planetNode.SelectSingleNode (strings.PlanetCoordsXPath).InnerText;
            System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match (coordsString, strings.PlanetCoordsRegex);

            //Koordinaten Parsen
            this._coords.Galaxy = Convert.ToInt32 (match.Groups [1].Value);
            this._coords.SunSystem = Convert.ToInt32 (match.Groups [2].Value);
            this._coords.Place = Convert.ToInt32 (match.Groups [3].Value);

            //Link auslesen:
            string linktToPlanet = planetNode.SelectSingleNode (strings.PlanetLinkXPath).Attributes ["href"].Value;
            this._id = Utils.StringReplaceToInt32 (Utils.SimpleRegex (linktToPlanet, strings.PlanetIDRegex));
        }
Example #12
0
        public void Execute()
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "BMP (*.BMP)|*.BMP|JPEG (*.JPEG; *.JPG)|*.JPEG;*.JPG";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    _drawingFeatures.PaintingArea.Image.Save(saveFileDialog.FileName);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Could not save the file");

                    Logger logger = new Logger();
                    logger.Log(e);
                }
            }
        }
Example #13
0
        public ITool CreateIToolObject(IDrawingFeatures drawingFeatures, string toolName)
        {
            switch (toolName)
            {
                case "RotateLeft90":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate90FlipXY);

                        return tool;
                    }
                case "RotateRight90":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate90FlipNone);

                        return tool;
                    }
                case "RotateRight180":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate180FlipNone);

                        return tool;
                    }
                case "RotateRight270":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.Rotate270FlipNone);

                        return tool;
                    }
                case "VerticalFlip":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipY);

                        return tool;
                    }
                case "HorizontalFlip":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipX);

                        return tool;
                    }
                case "HorizontalAndVerticalFlip":
                    {
                        ITool tool = new RotateTool(drawingFeatures, RotateFlipType.RotateNoneFlipXY);

                        return tool;
                    }
                case "RoundLine":
                    {
                        ITool tool = new LineShapeTool(drawingFeatures, LineCap.Round);

                        return tool;
                    }
                case "SquareLine":
                    {
                        ITool tool = new LineShapeTool(drawingFeatures, LineCap.Square);

                        return tool;
                    }
                case "Circle":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures,DrawingState.DrawCircle);

                        return tool;
                    }
                case "Rectangle":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawRectangle);

                        return tool;
                    }
                case "FilledCircle":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawFilledCircle);

                        return tool;
                    }
                case "FilledRectangle":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawFilledRectangle);

                        return tool;
                    }
                case "Line":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawLine);

                        return tool;
                    }
                case "Pencil":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.DrawPencil);

                        return tool;
                    }
                case "Eraser":
                    {
                        ITool tool = new EraserTool(drawingFeatures);

                        return tool;
                    }
                case "FloodFill":
                    {
                        ITool tool = new DrawingStyleTool(drawingFeatures, DrawingState.FloodFill);

                        return tool;
                    }
                default:
                    {
                        ITool tool = new NullTool();

                        Logger logger = new Logger();
                        logger.Log(new ArgumentException("ToolFactory - ToolName: " + toolName));

                        return tool;
                    }
            }
        }
Example #14
0
        public void SetShared(ILogger logger, int num)
        {
            Logger = (Logger)logger;
            if (num == 0)
            {
                _sharesNum = 1;
                Logger.Log(LogLevel.Error, "Packet {0}, shares must be > 0!! Setting to 1", ToString());
            }
            Shared = true;
            _sharesNum = num;
            Write();

            _buffer = new byte[Length];
            byte[] underlyingBuffer = Writer.UnderlyingStream.GetBuffer();
            try
            {
                Buffer.BlockCopy(underlyingBuffer, 0, _buffer, 0, Length);
            }
            catch (Exception e)
            {
                throw new Exception(String.Format("Writer {0}, Request {1} \r\n{2}", underlyingBuffer.Length, Length, e));
            }
        }
        static int Main(string[] args)
        {
            Console.WriteLine("");
            if (args.Length != 2){
                Console.WriteLine("Error: Number of argument is invalid !");
                PrintHelper();
                return (int)ExitCode.InvalidArguments;
            }

            string xmlFIlePath = args[0];
            string logFIlePath = args[1];

            if(!File.Exists(xmlFIlePath)){
                Console.WriteLine("Error: Xml file argument doesn't exist !");
                PrintHelper();
                return (int)ExitCode.InvalidArguments;
            }

            if(!Directory.Exists(Path.GetDirectoryName(logFIlePath))){
                Console.WriteLine("Error: The directory of the log file argument doesn't exist !");
                PrintHelper();
                return (int)ExitCode.InvalidArguments;
            }

            Logger logger=null;
            try{
                try{
                    logger = new Logger(args[1]);
                }catch(Exception ex){
                    Console.WriteLine("Failed to create log file: " + ex.Message);
                    return (int)ExitCode.InvalidArguments;
                }
                RunnerPlan data;
                try{
                    logger.Log("Parse xml file to get the compare plan (" + xmlFIlePath + ")");
                    data = RunnerPlan.ParseFromXml(xmlFIlePath);
                    logger.Log("\tCleanRegEx : " + data.CleanRegEx);
                    logger.Log("\tCompShape : " + data.CompShape);
                    logger.Log("\tCompStyle : " + data.CompStyle);
                    logger.Log("\tCompValue : " + data.CompValue);
                }catch(Exception ex){
                    logger.Log("Failed to parse Xml file: " + ex.Message);
                    return (int)ExitCode.FailedToParsePlan;
                }

                Compare compare;
                try{
                    compare = new Compare();
                    compare.InfoEvent += new InfoUpdateEventHandler(logger.Log);
                    compare.CompareFiles(data.FilesA, data.FilesB, data.CleanRegEx, data.ReportFolder, data.CompValue, data.CompStyle, data.CompStyle, true);
                }catch(Exception ex){
                    logger.Log("Failed to compare files: " + ex.Message);
                    return (int)ExitCode.FailedToCompare;
                }
                logger.Log("End of comparison.");
                return (int)ExitCode.Succeed;
            }catch(Exception){
                return (int)ExitCode.UnknownError;
            }finally{
                logger.Close();
            }
        }
Example #16
0
 public void SetShared(Logger logger, int num)
 {
     Logger = logger;
     if(num == 0)
     {
         _sharesNum = 1;
         Logger.Log(Logger.LogLevel.Error, "Packet {0}, shares must be > 0!! Setting to 1", ToString());
     }
     Shared = true;
     _sharesNum = num;
     Write();
 }
Example #17
0
 private static void DemoSimpleLogger()
 {
     // create a logger that outputs to the console using default log level (Verbose)
     var logger = new Logger(Console.WriteLine);
     logger.Log("using custom logger");
 }
Example #18
0
        //Initialize
        static Karuta()
        {
            //Init Vars
            _threads = new Dictionary<string, Thread>();
            _timers = new Dictionary<string, Timer>();
            _interpretor = new CommandInterpreter<Command>();
            logger = new Logger();
            random = new Random();
            //Prepare Console
            try
            {
                Console.Title = "Karuta";
                Console.BackgroundColor = ConsoleColor.DarkMagenta;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Clear();
            }catch(Exception e)
            {
                Write(e.StackTrace);
            }
            Stopwatch sw = new Stopwatch();
            sw.Start();
            Write("Preparing Karuta...");
            //Init Event Manager
            eventManager = new EventManager();
            eventManager.Init();
            //Init Registry
            Write("Loading Registry...");
            if(File.Exists(dataDir + "/karuta.data"))
            {
                registry = DataSerializer.deserializeData<Registry>(File.ReadAllBytes(dataDir + "/karuta.data"));
            }else
            {
                registry = new Registry();
                registry.Init();
                registry.SetValue("user", "user");
            }

            try
            {
                //Register Commands
                RegisterCommands();
                //Initalize commands
                Write("Initializing processes...");
                _interpretor.Init();
            }catch(Exception e)
            {
                Write($"An error occured while initializing commands: {e.Message}");
                Write(e.StackTrace);
            }
            sw.Stop();
            long elapsedT = sw.ElapsedTicks / (Stopwatch.Frequency / (1000L));

            Write($"Karuta is ready. Finished in {elapsedT}ms");
            logger.Log($"Karuta started in {elapsedT}ms", "Karuta");
        }
        protected override void Initialize()
        {
            _logger = Logger.GetLogger();
            _logSender = "PreviewWindow";
            _logger.Log(_logSender, "Initializing...");

            _cam = new Camera(GraphicsDevice);
            _cam.currentCameraMode = Camera.CameraMode.free;
            _cam.ResetCamera();
            _cam.SetFreeCamPosition(new Vector3(64, 50, 150));

            _tvm = new TransvoxelManager(GraphicsDevice);

            // Create our effect.
            _effect = new BasicEffect(GraphicsDevice);

            mBoundingBoxEffect = new BasicEffect(GraphicsDevice);
            mBoundingBoxEffect.LightingEnabled = false;
            mBoundingBoxEffect.VertexColorEnabled = true;

            _effect.VertexColorEnabled = true;

            // Start the animation timer.
            timer = Stopwatch.StartNew();
            // Hook the idle event to constantly redraw our animation.
            Application.Idle += delegate { Invalidate(); };
            _logger.Log(_logSender, "Initialization Complete.");

            updateTimer = new System.Timers.Timer(1 / 30f);
            updateTimer.AutoReset = true;
            updateTimer.Elapsed += Update;
            updateTimer.Start();
            verts = new VertexPositionColor[24];
        }
Example #20
0
        public void CanRegisterForMessageFailEvent()
        {
            // Arrange
            var logId = _fixture.Create<Guid>();
            var webClientMock = new Mock<IWebClient>();
            webClientMock
                .Setup(x => x.Post(It.IsAny<WebHeaderCollection>(), It.IsAny<Uri>(), It.IsAny<string>(), It.IsAny<Func<WebHeaderCollection, string, string>>()))
                .Returns(Task.Factory.StartNew<string>(() =>
                {
                    throw new System.ApplicationException("Some shit happened");
                }));
            var logger = new Logger(logId, null, webClientMock.Object);

            var eventHandlerWasCalled = false;
            Exception exception = null;
            Message message = null;

            logger.OnMessageFail += (sender, args) =>
            {
                eventHandlerWasCalled = true;
                exception = args.Error;
                message = args.Message;
            };

            // Act
            logger.Log(_fixture.Create<Message>());

            // Assert
            Assert.That(eventHandlerWasCalled);
            Assert.That(exception, Is.Not.Null);
            Assert.That(message, Is.Not.Null);
        }
        public async Task LogQueueItemCreated()
        {
            // Arrange
            LogQueueItem result = null;
            _queue.Setup(x => x.EnqueueAsync(It.IsAny<LogQueueItem>())).Callback<LogQueueItem>(p => result = p);
            Logger logger = new Logger(_runtimeEnvironment.Object, _queue.Object, _source.Object, _extension.Object, LogLevelEnum.Debug, _correlationIdProvider.Object);
            DateTimeOffset baseline = DateTimeOffset.UtcNow;

            // Act
            await logger.Log(LogLevelEnum.Warning, "A message", new Exception("Some message"));

            // Assert
            Assert.AreEqual("A message", result.Message);
            Assert.AreEqual(LogLevelEnum.Warning, result.Level);
            Assert.IsTrue(result.LoggedAt >= baseline && result.LoggedAt <= DateTimeOffset.UtcNow);
            Assert.AreEqual("System.Exception", result.ExceptionName);
            Assert.IsNull(result.InnerExceptionName);
            Assert.AreEqual("a.name", result.Source);
        }
Example #22
0
        public void CanRegisterForMessageEvent()
        {
            // Arrange
            var logId = _fixture.Create<Guid>();
            var webClientMock = new Mock<IWebClient>();
            var logger = new Logger(logId, null, webClientMock.Object);

            var eventHandlerWasCalled = false;
            Message message = null;

            logger.OnMessage += (sender, args) =>
            {
                eventHandlerWasCalled = true;
                message = args.Message;
            };

            // Act
            logger.Log(_fixture.Create<Message>());

            // Assert
            Assert.That(eventHandlerWasCalled);
            Assert.That(message, Is.Not.Null);
        }