public void GetRuleSettings_WhenCalled_ReturnsList() { var rule = new BodyMatchRule(3, "010203"); var list = new List <RuleSetting>(rule.GetRuleSettings()); Assert.AreEqual(2, list.Count); }
public void InitializeFromSettings_WithNullSettings_ThrowsException() { var rule = new BodyMatchRule(); Assert.That( () => rule.InitializeFromSettings(null), Throws.Exception.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("settings")); }
public void InitializeFromSettings_WithNullSettings_ThrowsException() { var rule = new BodyMatchRule(); Assert.That( () => rule.InitializeFromSettings(null), Throws.Exception.TypeOf <ArgumentNullException>().With.Property("ParamName").EqualTo("settings")); }
public void IsMatch_GivenBodyDifferentFromRuleButSameSize_ReturnsFalse() { var requestBody = GenerateByteArray(3, Environment.TickCount); var rule = new BodyMatchRule(3, "010203"); var request = CreateRequest(requestBody); Assert.IsFalse(rule.IsMatch(request)); }
public void IsMatch_GivenBodyIsSameAsRule_ReturnsTrue() { var requestBody = new byte[] { 1, 2, 3 }; var rule = new BodyMatchRule(3, "5289DF737DF57326FCDD22597AFB1FAC"); var request = CreateRequest(requestBody); Assert.IsTrue(rule.IsMatch(request)); }
public void IsMatch_WithDifferentBodySizes_ReturnsFalse() { var requestBody = GenerateByteArray(10, Environment.TickCount); var rule = new BodyMatchRule(3, "010203"); var request = CreateRequest(requestBody); Assert.IsFalse(rule.IsMatch(request)); }
public void InitializeFromSettings_WithValidSettings_InitializesCorrectly() { var settings = new[] { new RuleSetting { Name = "body.length", Value = "3" }, new RuleSetting { Name = "body.md5", Value = "010203" } }; var rule = new BodyMatchRule(); rule.InitializeFromSettings(settings); Assert.IsTrue(rule.IsInitialized); Assert.AreEqual(3, rule.BodyLength); Assert.AreEqual("010203", rule.Md5Hash); }
public void GetRuleSettings_WhenCalled_ReturnsList() { var rule = new BodyMatchRule(3, "010203"); var list = new List<RuleSetting>(rule.GetRuleSettings()); Assert.AreEqual(2, list.Count); }
public void Constructor_Default_NotInitialized() { var rule = new BodyMatchRule(); Assert.IsFalse(rule.IsInitialized); }
public void IsMatch_WithNullRequest_ReturnsFalse() { var rule = new BodyMatchRule(3, "010203"); Assert.IsFalse(rule.IsMatch(null)); }