Ejemplo n.º 1
0
        private void TestLogAspect(ISomething something,
                                   Record record)
        {
            m_Bus.SubscribeAsync <StatusMessage>(GetType().FullName,
                                                 StatusHandler);

            something.DoSomething("");
            m_Logger.Debug("Augment 10 returns {0}".Inject(something.Augment(10)));
            something.DoSomething(record);
        }
Ejemplo n.º 2
0
        public void Main()
        {
            var something = m_Container.Resolve <ISomething>();
            var record = new Record(1.0,
                                    2.0,
                                    "Hello World",
                                    3.0);

            TestLogAspect(something,
                          record);

            TestPublishExceptionAspect(something,
                                       record);

            StatusAspect(something,
                         record);
        }
Ejemplo n.º 3
0
 public void DoSomethingStatus(Record record)
 {
     Console.WriteLine(record);
 }
Ejemplo n.º 4
0
 public void DoSomethingThrows(Record record)
 {
     Console.WriteLine("I'm doing something (record) and throw: " + record);
     throw new ArgumentException("Test");
 }
Ejemplo n.º 5
0
        private void TestPublishExceptionAspect(ISomething something,
                                                Record record)
        {
            try
            {
                m_Bus.SubscribeAsync <ExceptionThrownMessage>(GetType().FullName,
                                                              ExceptionThrownHandler);

                something.DoSomethingThrows(record);
            }
            catch ( Exception exception )
            {
                m_Logger.Debug("Try/Catch {0}".Inject(exception.Message));
            }
        }
Ejemplo n.º 6
0
 private void StatusAspect(ISomething something,
                           Record record)
 {
     something.DoSomethingStatus("");
     something.DoSomethingStatus(record);
 }