public void Add_type_adds_a_type_to_cache()
        {
            // Arrange
            Type fixtureType = typeof(ComponentFixture);

            // Act
            TypeCache.AddType(fixtureType);
            Type cachedType = TypeCache.GetType <ComponentFixture>();

            // Assert
            Assert.IsTrue(object.ReferenceEquals(fixtureType, cachedType));
        }
        public void Clear_type_from_pool_clears_cache()
        {
            // Arrange
            var fixture = new TypePoolFixture();

            TypeCache.AddType(typeof(TypePoolFixture));

            // Act
            TypeCache.ClearTypeFromPool(fixture);

            // Assert
            Assert.IsFalse(TypeCache.HasTypeInCache <TypePoolFixture>());
        }
        public void Has_type_in_cache_returns_true_when_type_is_cached()
        {
            // Arrange
            var fixture = new TypePoolFixture();

            TypeCache.AddType(typeof(TypePoolFixture));

            // Act
            bool exists = TypeCache.HasTypeInCache(fixture);

            // Assert
            Assert.IsTrue(exists);
        }
        public void Get_type_by_name_returns_type()
        {
            // Arrange
            Type componentFixture = typeof(ComponentFixture);
            Type typePoolFixture  = typeof(TypePoolFixture);

            TypeCache.AddType(componentFixture);
            TypeCache.AddType(typePoolFixture);

            // Act
            Type returnedType = TypeCache.GetTypeByName(typeof(TypePoolFixture).Name);

            // Assert
            Assert.IsNotNull(returnedType);
        }
        public void Add_type_twice_does_not_return_duplicates()
        {
            // Arrange
            Type fixtureType  = typeof(ComponentFixture);
            Type fixtureType2 = typeof(ComponentFixture);

            // Act
            TypeCache.AddType(fixtureType);
            TypeCache.AddType(fixtureType2);

            IEnumerable <Type> types = TypeCache.GetTypes(type => type == typeof(ComponentFixture));

            // Assert
            Assert.AreEqual(1, types.Count());
        }
 public void Null_type_throws_exception_when_manually_added()
 {
     // Act
     TypeCache.AddType(null);
 }