public void AuditSuccess_EnabledFailuresOnly()
        {
            auditElementMock.SetupGet(d => d.Enabled).Returns(true);
            auditElementMock.SetupGet(d => d.LogOnlyFailures).Returns(true);

            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAudit.Start(MessageType.AuditResetPassword);
                ScarfAudit.Succeeded();
                context.Commit();
            }

            Assert.AreEqual(0, dataSource.Messages.Count);
        }
Пример #2
0
 public override void OnActionExecuted(HttpActionExecutedContext filterContext)
 {
     if (ScarfAudit.HasResult == false)
     {
         if (filterContext.Exception != null)
         {
             ScarfAudit.Failed();
         }
         else
         {
             ScarfAudit.Succeeded();
         }
     }
     base.OnActionExecuted(filterContext);
 }
Пример #3
0
 public override void OnActionExecuted(System.Web.Mvc.ActionExecutedContext filterContext)
 {
     if (ScarfAudit.HasResult == false)
     {
         if (filterContext.Canceled ||
             (filterContext.Exception != null &&
              filterContext.ExceptionHandled == false))
         {
             ScarfAudit.Failed();
         }
         else
         {
             ScarfAudit.Succeeded();
         }
     }
     base.OnActionExecuted(filterContext);
 }