public void TestRegisterTNull()
        {
            var cache = new PropertyGetterCache();

            Assert.ThrowsException<ArgumentNullException>(
                () => cache.Register<PropertyGetterCacheTests>(
                    nameof(TestContext),
                    null
                )
            );
        }
        public void TestRegisterAlreadyRegistered()
        {
            var cache = new PropertyGetterCache();

            cache.Register(
                typeof(PropertyGetterCacheTests),
                nameof(TestContext),
                (obj) => 5
            );
            cache.Register(
                typeof(PropertyGetterCacheTests),
                nameof(TestContext),
                (obj) => 7
            );

            var getter = cache.Get(
                typeof(PropertyGetterCacheTests),
                nameof(TestContext)
            );

            Assert.AreEqual(7, getter(this));
        }
        public void TestIndexer()
        {
            var cache = new PropertyGetterCache();
            cache.Register(
                typeof(PropertyGetterCacheTests),
                nameof(TestContext),
                (obj) => 5
            );

            var typeCache = cache[typeof(PropertyGetterCacheTests)];

            Assert.IsNotNull(typeCache);
            Assert.AreEqual(typeof(PropertyGetterCacheTests), typeCache.Type);
        }
        public void TestGetRegisteredGeneric()
        {
            var cache = new PropertyGetterCache();
            cache.Register<PropertyGetterCacheTests>(
                nameof(TestContext),
                (obj) => 5
            );

            Func<object, object> getter = cache.Get(
                typeof(PropertyGetterCacheTests),
                nameof(TestContext)
            );

            Assert.AreEqual(5, getter(this));
        }