Example #1
0
        public void TryGetValueForMissingKey()
        {
            var key = "hello";
            var expectedValue = 42;

            var dict = new Dictionary<string, object> {{"irrelevent", expectedValue}};

            var result = dict.MaybeGetValue(key);
            
            Assert.That(!result.IsSome);
        }
Example #2
0
        public void TryGetValueForPresentKey()
        {
            var key = "hello";
            var expectedValue = 42;

            var dict = new Dictionary<string, object> {{key, expectedValue}};

            var result = dict.MaybeGetValue(key);
            
            Assert.That(result.IsSome);
            Assert.That(result.ForceValue(), Is.EqualTo(expectedValue));
        }