Пример #1
0
        public void TextMapHelperGetBoolFromMap()
        {
            tlog.Debug(tag, $"TextMapHelperGetBoolFromMap START");

            var stringKey        = "width";
            var stringInvalidKey = "invalidKey";
            var intKey           = 1;
            var intInvalidKey    = 10;
            var value            = true;
            var defaultValue     = false;

            var map = new PropertyMap();

            map.Add(stringKey, new PropertyValue(value));
            map.Add(intKey, new PropertyValue(value));

            var result = TextMapHelper.GetBoolFromMap(map, stringKey, defaultValue);

            Assert.AreEqual(value, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, stringInvalidKey, defaultValue);
            Assert.AreEqual(defaultValue, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, intKey, defaultValue);
            Assert.AreEqual(value, result, "Should be equal!");

            result = TextMapHelper.GetBoolFromMap(map, intInvalidKey, defaultValue);
            Assert.AreEqual(defaultValue, result, "Should be equal!");

            tlog.Debug(tag, $"TextMapHelperGetBoolFromMap END (OK)");
        }