public void ReturnsFalseWhenTheSettingIsNotInTheSafelist() { var mockInnerFilter = new Mock <ISettingFilter>(); var filter = new SafelistSettingFilter(new[] { "foo" }, mockInnerFilter.Object); filter.ShouldProcessSettingChange("bar", new Dictionary <string, object>()) .Should().Be(false); mockInnerFilter.Verify(m => m.ShouldProcessSettingChange( It.IsAny <string>(), It.IsAny <IReadOnlyDictionary <string, object> >()), Times.Never); }
public void ReturnsWhatTheInnerFilterReturnsWhenTheSettingIsAChildOfAnItemInTheAllowlist() { var mockInnerFilter = new Mock <ISettingFilter>(); mockInnerFilter .Setup(m => m.ShouldProcessSettingChange(It.IsAny <string>(), It.IsAny <IReadOnlyDictionary <string, object> >())) .Returns(false); var filter = new SafelistSettingFilter(new[] { "foo" }, mockInnerFilter.Object); var receivedMessageHeaders = new Dictionary <string, object>(); filter.ShouldProcessSettingChange("foo:bar", receivedMessageHeaders) .Should().Be(false); mockInnerFilter.Verify(m => m.ShouldProcessSettingChange( It.Is <string>(s => s == "foo:bar"), It.Is <IReadOnlyDictionary <string, object> >(headers => headers == receivedMessageHeaders))); }