Example #1
0
        public void Start()
        {
            using (EventProcessor processor = new EventProcessor())
            {
                var eventsLogged = 0;
                var eventsSaved  = 0;

                processor.OnEventLogged += (sender, args) =>
                {
                    Interlocked.Increment(ref eventsLogged);
                    if (args.Success)
                    {
                        Interlocked.Increment(ref eventsSaved);
                    }
                };

                var eventsToProcess = LoggingEventFactory.GetEvents(100);

                foreach (var loggingEvent in eventsToProcess)
                {
                    processor.LogEvent(loggingEvent);
                }

                while (eventsLogged < 100)
                {
                }

                Debug.Assert(eventsLogged == eventsSaved);
            }
        }
Example #2
0
        public void Constructor_DependenciesInjected_DependenciesAreStoredCorrectly()
        {
            var messageEncryption = new RijndaelMessageEncryptor();
            var logEventFactory   = new LoggingEventFactory();

            var localTarget = new MessageEncryptingForwardingAppender(messageEncryption, logEventFactory);

            Assert.AreSame(messageEncryption, localTarget.MessageEncryption);
            Assert.AreSame(logEventFactory, localTarget.LogEventFactory);
        }
Example #3
0
 public void __init()
 {
     _target = new LoggingEventFactory();
 }