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); }
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); }
public void DoSomethingStatus(Record record) { Console.WriteLine(record); }
public void DoSomethingThrows(Record record) { Console.WriteLine("I'm doing something (record) and throw: " + record); throw new ArgumentException("Test"); }
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)); } }
private void StatusAspect(ISomething something, Record record) { something.DoSomethingStatus(""); something.DoSomethingStatus(record); }