Exemplo n.º 1
0
        public void ShouldGetMemoizedInstanceForType()
        {
            var type            = typeof(object);
            var instance        = ClassInstanceManager.Get(type);
            var anotherInstance = ClassInstanceManager.Get(type);

            Assert.AreSame(instance, anotherInstance);
        }
Exemplo n.º 2
0
        public void ShouldGetInstanceForType()
        {
            var type     = typeof(object);
            var instance = ClassInstanceManager.Get(type);

            Assert.NotNull(instance);
            Assert.AreEqual(instance.GetType(), type);
        }
Exemplo n.º 3
0
        public void ShouldNotGetMemoizedInstanceForTypeWhenClassObjectMapIsCleared()
        {
            var type     = typeof(object);
            var instance = ClassInstanceManager.Get(type);

            ClassInstanceManager.ClearCache();
            var anotherInstance = ClassInstanceManager.Get(type);

            Assert.AreNotSame(instance, anotherInstance);
        }