public void BooleanTest()
        {
            string key        = "key";
            var    properties = new ExtentionPropertyCollection();

            // проверим GetBooleanOrNull когда нет значения
            bool?value = properties.GetBooleanOrNull(key);

            Assert.Null(value);

            // проверим GetBoolean когда нет значения
            Assert.Throws <KeyNotFoundException>(() => properties.GetBoolean(key));

            // проверим GetBooleanOrNull когда значение есть
            properties.Set(key, true);
            value = properties.GetBooleanOrNull(key);
            Assert.True(value.HasValue);
            Assert.True(value == true);

            // проверим GetBoolean когда значение есть
            value = null;
            value = properties.GetBoolean(key);
            Assert.True(value.HasValue);
            Assert.True(value == true);
        }
        public void ComplextTest()
        {
            string key        = "key";
            var    properties = new ExtentionPropertyCollection();

            Assert.Equal(0, properties.Count);

            // проверим методы GetXxxOrNull когда значения нет
            Assert.Null(properties.GetBooleanOrNull(key));
            Assert.Null(properties.GetInt32OrNull(key));
            Assert.Null(properties.GetInt64OrNull(key));
            Assert.Null(properties.GetDoubleOrNull(key));
            Assert.Null(properties.GetDateTimeOrNull(key));
            Assert.Null(properties.GetStringOrNull(key));

            // проверим методы Get когда значения есть
            properties.Set(key, true);
            Assert.True(properties.GetBooleanOrNull(key) == true);
            Assert.True(properties.GetBoolean(key) == true);

            properties.Set(key, int.MaxValue);
            Assert.True(properties.GetInt32OrNull(key) == int.MaxValue);
            Assert.True(properties.GetInt32(key) == int.MaxValue);

            properties.Set(key, long.MaxValue);
            Assert.True(properties.GetInt64OrNull(key) == long.MaxValue);
            Assert.True(properties.GetInt64(key) == long.MaxValue);

            properties.Set(key, 1000.05);
            Assert.True(properties.GetDoubleOrNull(key) == 1000.05);
            Assert.True(properties.GetDouble(key) == 1000.05);

            var now = DateTime.Now;

            now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
            properties.Set(key, now);
            Assert.True(properties.GetDateTimeOrNull(key) == now);
            Assert.True(properties.GetDateTime(key) == now);

            properties.Set(key, "value");
            Assert.True(properties.GetStringOrNull(key) == "value");
            Assert.True(properties.GetString(key) == "value");

            Assert.Equal(1, properties.Count);
        }