public void ShouldContainKeyAndValue_WorkWithGuids()
 {
     var guiddy = Guid.NewGuid();
     var dictionary = new Dictionary<string, Guid>();
     dictionary.Add("key", guiddy);
     dictionary.ShouldContainKeyAndValue("key", guiddy);
 }
        public void ShouldContainKeyAndValue_ShouldWorkWithObjects()
        {
            var guid = Guid.NewGuid();
            var dictionary2 = new Dictionary<string, Guid> {{"key", guid}};

            dictionary2.ShouldContainKeyAndValue("key", guid);
        }
        public void ShouldContainKeyAndValue()
        {
            DocExampleWriter.Document(() =>
            {
                var websters = new Dictionary<string, string>();
                websters.Add("Cromulent", "I never heard the word before moving to Springfield.");

                websters.ShouldContainKeyAndValue("Cromulent", "Fine, acceptable.");
            }, _testOutputHelper);
        }
        public void ValueIsNullShouldFail()
        {
            var dictionaryWithNullValue = new Dictionary<MyThing, MyThing>
            {
                {ThingKey, null}
            };
            Verify.ShouldFail(() =>
dictionaryWithNullValue.ShouldContainKeyAndValue(ThingKey, new MyThing(), "Some additional context"),

errorWithSource:
@"dictionaryWithNullValue
    should contain key
Shouldly.Tests.TestHelpers.MyThing (000000)
    with value
Shouldly.Tests.TestHelpers.MyThing (000000)
    but value was
null

Additional Info:
    Some additional context",

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

Additional Info:
    Some additional context");
        }
Example #5
0
        public void IterationShouldWalkThroughAllKnownAndExtraKeyValuePairs()
        {
            var requestContext = new RequestContext();
            var custom = new Object();

            _env["System.Web.Routing.RequestContext"] = requestContext;
            _env["Custom"] = custom;

            var dict = new Dictionary<string, object>();
            foreach (var kv in _env)
            {
                dict.Add(kv.Key, kv.Value);
            }

            dict.ShouldContainKeyAndValue("System.Web.Routing.RequestContext", requestContext);
            dict.ShouldContainKeyAndValue("Custom", custom);
        }
 public void ShouldContainKeyAndValue_WhenTrue_ShouldNotThrow()
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("key", "value");
     dictionary.ShouldContainKeyAndValue("key","value");
 }
Example #7
0
        public void ShouldContainKey()
        {
            var websters = new Dictionary<string, string>();
            websters.Add("Chazzwazzers", "What Australians would have called a bull frog.");

            websters.ShouldContainKeyAndValue("Chazzwazzers", "What Australians would have called a bull frog.");
        }