示例#1
0
        public void ContainsKey_When_IDictionary_is_null_It_should_throw_ArgumentNullException()
        {
            IDictionary <string, int> dict = null;

            AssertIsNotNull(
                () => Ensure.That(dict, ParamName).ContainsKey("B"),
                () => EnsureArg.ContainsKey(dict, "B", ParamName));
        }
示例#2
0
        public void ContainsKey_When_key_exists_in_IDictionary_It_should_not_throw()
        {
            IDictionary <string, int> dict = new Dictionary <string, int> {
                { "A", 1 }, { "B", 2 }, { "C", 3 }
            };

            ShouldNotThrow(
                () => Ensure.That(dict, ParamName).ContainsKey("B"),
                () => EnsureArg.ContainsKey(dict, "B", ParamName));
        }
示例#3
0
        public void ContainsKey_When_key_does_not_exist_in_IDictionary_It_throws_ArgumentException()
        {
            IDictionary <string, int> dict = new Dictionary <string, int> {
                { "A", 1 }, { "B", 2 }, { "C", 3 }
            };
            const string expectedKey = "Foo";

            AssertContainsKey(
                expectedKey,
                () => Ensure.That(dict, ParamName).ContainsKey(expectedKey),
                () => EnsureArg.ContainsKey(dict, expectedKey, ParamName));
        }