public void Test_AddDuplicateThreshold() { string evtName = Guid.NewGuid().ToString(); IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); Threshold threshold = new Threshold(evtName, 1, 1, new[] { BuiltinActions.FormsAuthenticationLogout }); detector.AddThreshold(threshold); Threshold dup = new Threshold(evtName, 2, 2, null); detector.AddThreshold(dup); }
public void Test_AddNullThreshold() { IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); detector.AddThreshold(null); }
public void Test_AddThresholdMissingAction() { string evtName = Guid.NewGuid().ToString(); IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); Threshold threshold = new Threshold(evtName, 1, 1, new[] { Guid.NewGuid().ToString() }); detector.AddThreshold(threshold); }
public void Test_IntrusionDetected() { string evtName = Guid.NewGuid().ToString(); IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); Threshold threshold = new Threshold(evtName, 1, 1, new[] { "log" }); detector.AddThreshold(threshold); Esapi.IntrusionDetector.AddEvent(evtName); }
public void Test_RemoveThreshold() { string evtName = Guid.NewGuid().ToString(); IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); Threshold threshold = new Threshold(evtName, 1, 1, new[] { "logout" }); detector.AddThreshold(threshold); Assert.IsTrue(detector.RemoveThreshold(evtName)); }
public void Test_AddExceptionSecurityEvent() { string evtName = typeof(ArgumentException).FullName; IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); Threshold threshold = new Threshold(evtName, 1, 1, new[] { "log" }); detector.AddThreshold(threshold); ArgumentException arg = new ArgumentException(); detector.AddException(arg); }