public void Extension_throws_exception_when_used_with_invalid_expression() { var fixture = new TypePoolFixture(); // Act string propertyName = fixture.GetPropertyName(p => p.IsEnabled && p.IsEnabled); // Assert Assert.AreEqual("CreationDate", propertyName); }
public void Get_properties_from_instance() { // Arrange var fixture = new TypePoolFixture(); // Act IEnumerable<PropertyInfo> properties = PropertyCache.GetPropertiesForType(fixture); // Assert Assert.IsNotNull(properties); }
public void Get_properties_from_instance_with_predicate() { // Arrange var fixture = new TypePoolFixture(); // Act IEnumerable<PropertyInfo> properties = PropertyCache.GetPropertiesForType( fixture, p => p.Name == fixture.GetPropertyName(pr => pr.IsEnabled)); // Assert Assert.IsNotNull(properties); }
public void Get_properties_from_null_instance_throws_exception() { // Arrange var fixture = new TypePoolFixture(); // Act IEnumerable<PropertyInfo> properties = PropertyCache.GetPropertiesForType<TypePoolFixture>(null, null); }
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 Get_type_from_instance_returns_cached_type() { // Arrange var fixture = new TypePoolFixture(); Type originalType = TypeCache.GetType(fixture); // Act Type cachedType = TypeCache.GetType(fixture); // Assert Assert.AreEqual(typeof(TypePoolFixture), cachedType); Assert.IsTrue(object.ReferenceEquals(originalType, cachedType), "The cached type was not returned."); }
public void Get_type_from_instance_returns_a_type() { // Arrange var fixture = new TypePoolFixture(); // Act Type cachedType = TypeCache.GetType(fixture); // Assert Assert.AreEqual(typeof(TypePoolFixture), cachedType); }
public void Has_type_in_cache_returns_false_when_type_is_never_cached() { // Arrange var fixture = new TypePoolFixture(); // Act bool exists = TypeCache.HasTypeInCache(fixture); // Assert Assert.IsFalse(exists); }
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); }