public void AutomaticallyCastsObjectsToRightTypesIfPossible()
        {
            var propertyBag = new TypedPropertyBag();

            propertyBag.SetValue("Int", 42);
            propertyBag.SetValue("Int", (object)52);

            Assert.AreEqual(52, propertyBag.GetValue("Int", 0));
        }
        public void PreventsRegistrationWithDifferentTypes_2()
        {
            var propertyBag = new TypedPropertyBag();

            propertyBag.SetValue("Int", 42);
            ExceptionTester.CallMethodAndExpectException <InvalidCastException>(() => propertyBag.SetValue("Int", new object()));
        }
        public void PreventsRegistrationWithNullValue()
        {
            var propertyBag = new TypedPropertyBag();

            propertyBag.SetValue("Int", 42);
            ExceptionTester.CallMethodAndExpectException <InvalidOperationException>(() => propertyBag.SetValue("Int", (object)null));
        }