示例#1
0
        public void LogEventSendsEventToLogger()
        {
            string        projectName = "Test Project";
            string        userName    = "******";
            SecurityEvent eventType   = SecurityEvent.ForceBuild;
            SecurityRight eventRight  = SecurityRight.Allow;
            string        message     = "A message";

            IAuditLogger logger = mocks.Create <IAuditLogger>(MockBehavior.Strict).Object;

            Mock.Get(logger).Setup(_logger => _logger.LogEvent(projectName, userName, eventType, eventRight, message)).Verifiable();

            manager.AuditLoggers = new IAuditLogger[] {
                logger
            };
            manager.Initialise();
            manager.LogEvent(projectName, userName, eventType, eventRight, message);
        }
        public void LogEventSendsEventToLogger()
        {
            string        projectName = "Test Project";
            string        userName    = "******";
            SecurityEvent eventType   = SecurityEvent.ForceBuild;
            SecurityRight eventRight  = SecurityRight.Allow;
            string        message     = "A message";

            IAuditLogger logger = mocks.CreateMock <IAuditLogger>();

            Expect.Call(delegate { logger.LogEvent(projectName, userName, eventType, eventRight, message); });

            mocks.ReplayAll();
            manager.AuditLoggers = new IAuditLogger[] {
                logger
            };
            manager.Initialise();
            manager.LogEvent(projectName, userName, eventType, eventRight, message);
        }