Example #1
0
        public void ValueIsNullShouldFail()
        {
            var dictionary = new Dictionary <MyThing, MyThing>
            {
                { ThingKey, null }
            };

            Verify.ShouldFail(() =>
                              dictionary.ShouldNotContainValueForKey(ThingKey, null, "Some additional context"),

                              errorWithSource:
                              @"dictionary
    should not contain key
Shouldly.Tests.TestHelpers.MyThing (000000)
    with value
null
    but does

Additional Info:
    Some additional context",

                              errorWithoutSource:
                              @"[[Shouldly.Tests.TestHelpers.MyThing (000000) => null]]
    should not contain key
Shouldly.Tests.TestHelpers.MyThing (000000)
    with value
null
    but does

Additional Info:
    Some additional context");
        }
Example #2
0
        public void ShouldNotContainValueForKey_WhenTrue_ShouldNotThrow()
        {
            var dictionary = new Dictionary <string, string> {
                { "key", "value" }
            };

            dictionary.ShouldNotContainValueForKey("key", "slurpee");
        }
        public void ShouldNotContainKeyAndValue()
        {
            DocExampleWriter.Document(() =>
            {
                var websters = new Dictionary<string, string>();
                websters.Add("Chazzwazzers", "What Australians would have called a bull frog.");

                websters.ShouldNotContainValueForKey("Chazzwazzers",  "What Australians would have called a bull frog.");
            }, _testOutputHelper);
        }
        public void ShouldNotContainKeyAndValue()
        {
            DocExampleWriter.Document(() =>
            {
                var websters = new Dictionary <string, string>();
                websters.Add("Chazzwazzers", "What Australians would have called a bull frog.");

                websters.ShouldNotContainValueForKey("Chazzwazzers", "What Australians would have called a bull frog.");
            }, _testOutputHelper);
        }
Example #5
0
 protected override void ShouldThrowAWobbly()
 {
     _dictionary.ShouldNotContainValueForKey("Foo", "Bar");
 }
Example #6
0
 protected override void ShouldThrowAWobbly()
 {
     _dictionary.ShouldNotContainValueForKey(ThingKey, ThingValue, "Some additional context");
 }
 public void ShouldNotContainValueForKey_WhenTrue_ShouldNotThrow()
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("key", "value");
     dictionary.ShouldNotContainValueForKey("key", "slurpee");
 }
Example #8
0
 protected override void ShouldThrowAWobbly()
 {
     _dictionary.ShouldNotContainValueForKey(ThingKey, ThingValue);
 }
 protected override void ShouldThrowAWobbly()
 {
     _dictionary.ShouldNotContainValueForKey("Bar", "Baz", "Some additional context");
 }
Example #10
0
 protected override void ShouldThrowAWobbly()
 {
     _dictionary.ShouldNotContainValueForKey(GuidKey, GuidValue);
 }
        public void ValueIsNullShouldFail()
        {
            var dictionary = new Dictionary<MyThing, MyThing>
            {
                {ThingKey, null}
            };
            Verify.ShouldFail(() =>
dictionary.ShouldNotContainValueForKey(ThingKey, null, "Some additional context"),

errorWithSource:
@"dictionary
    should not contain key
Shouldly.Tests.TestHelpers.MyThing (000000)
    with value
null
    but does

Additional Info:
    Some additional context",

errorWithoutSource:
@"[[Shouldly.Tests.TestHelpers.MyThing (000000) => null]]
    should not contain key
Shouldly.Tests.TestHelpers.MyThing (000000)
    with value
null
    but does

Additional Info:
    Some additional context");
        }