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);
        }
Ejemplo n.º 2
0
        public void LogoutAudit()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAudit.Start(MessageType.AuditLogout);
                ScarfAudit.LoggedOut("Test");
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.AreEqual(MessageClass.Audit, msg.MessageClass);
            Assert.AreEqual(MessageType.AuditLogout, msg.MessageType);
        }
Ejemplo n.º 3
0
        public void CreateUserAudit()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAudit.Start(MessageType.AuditCreateUser);
                ScarfAudit.UserCreated("Test");
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.AreEqual(MessageClass.Audit, msg.MessageClass);
            Assert.AreEqual(MessageType.AuditCreateUser, msg.MessageType);
            Assert.AreEqual(true, msg.Success.Value);
        }
Ejemplo n.º 4
0
        public void LoginAuditFailed()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAudit.Start(MessageType.AuditLogin);
                ScarfAudit.Failed();
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.AreEqual(MessageClass.Audit, msg.MessageClass);
            Assert.AreEqual(MessageType.AuditLogin, msg.MessageType);
            Assert.AreEqual(false, msg.Success.Value);
        }
Ejemplo n.º 5
0
        public void ResetPasswordAudit()
        {
            using (IScarfContext context = ScarfLogging.BeginInlineContext())
            {
                ScarfAudit.Start(MessageType.AuditResetPassword);
                ScarfAudit.PasswordReset("Test");
                context.Commit();
            }

            ScarfLogMessage msg = dataSource.Messages.Single();

            Assert.AreEqual(MessageClass.Audit, msg.MessageClass);
            Assert.AreEqual(MessageType.AuditResetPassword, msg.MessageType);
            Assert.AreEqual(true, msg.Success.Value);
        }