Ejemplo n.º 1
0
 public override void OnActionExecuted(System.Web.Mvc.ActionExecutedContext filterContext)
 {
     if (string.IsNullOrWhiteSpace(Message) == false)
     {
         ScarfAction.SetMessage(Message);
     }
     base.OnActionExecuted(filterContext);
 }
Ejemplo n.º 2
0
        public void ActionWithCodeBasedMessage()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                var attribute = new LogApiActionAttribute(MessageType.ActionPayment);
                BeforeAction(attribute);
                ScarfAction.SetMessage("From code");
                AfterAction(attribute);
            }

            Assert.AreEqual(1, dataSource.Messages.Count);
            Assert.AreEqual("From code", dataSource.Messages.Single().Message);
        }
        public void TestAddCustomInfo()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAction.Start(MessageType.ActionPayment);
                ScarfLogging.AddCustomInfo("organizationId", "5");
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.IsTrue(msg.AdditionalInfo.ContainsKey(ScarfLogMessage.AdditionalInfo_Custom));
            Assert.AreEqual("5", msg.AdditionalInfo[ScarfLogMessage.AdditionalInfo_Custom]["organizationId"]);
        }
Ejemplo n.º 4
0
        public void Action()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAction.Start(MessageType.ActionCommand);
                ScarfAction.SetMessage("Performed command");
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.AreEqual(MessageClass.Action, msg.MessageClass);
            Assert.AreEqual(MessageType.ActionCommand, msg.MessageType);
        }