public void CorrectlyRegistersNonCatelProperties() { var catelTypeInfo = new CatelTypeInfo(typeof(CatelTypeInfoTestModel)); var properties = catelTypeInfo.GetNonCatelProperties(); Assert.AreNotEqual(0, properties.Count); Assert.IsTrue(properties.Keys.Contains("NormalProperty")); }
/// <summary> /// Unregisters a property for a specific type. /// </summary> /// <param name="type">The type for which to register the property.</param> /// <param name="name">The name of the property.</param> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">The <paramref name="name"/> is <c>null</c> or whitespace.</exception> public void UnregisterProperty(Type type, string name) { Argument.IsNotNullOrWhitespace("name", name); lock (_propertyDataLock) { if (!_propertyData.ContainsKey(type)) { _propertyData[type] = new CatelTypeInfo(type); } _propertyData[type].UnregisterProperty(name); } }
/// <summary> /// Registers all the properties for the specified type. /// <para /> /// This method can only be called once per type. The <see cref="PropertyDataManager"/> caches /// whether it has already registered the properties once. /// </summary> /// <param name="type">The type to register the properties for.</param> /// <returns>The property data type info.</returns> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">The properties are not declared correctly.</exception> public CatelTypeInfo RegisterProperties(Type type) { Argument.IsNotNull("type", type); lock (_propertyDataLock) { if (!_propertyData.TryGetValue(type, out var typeInfo)) { typeInfo = new CatelTypeInfo(type); _propertyData[type] = typeInfo; } return(typeInfo); } }
/// <summary> /// Unregisters a property for a specific type. /// </summary> /// <param name="type">The type for which to register the property.</param> /// <param name="name">The name of the property.</param> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">The <paramref name="name"/> is <c>null</c> or whitespace.</exception> public void UnregisterProperty(Type type, string name) { Argument.IsNotNullOrWhitespace("name", name); lock (_propertyDataLock) { if (!_propertyData.TryGetValue(type, out var typeInfo)) { typeInfo = new CatelTypeInfo(type); _propertyData[type] = typeInfo; } typeInfo.UnregisterProperty(name); } }
/// <summary> /// Registers all the properties for the specified type. /// <para /> /// This method can only be called once per type. The <see cref="PropertyDataManager"/> caches /// whether it has already registered the properties once. /// </summary> /// <param name="type">The type to register the properties for.</param> /// <returns>The property data type info.</returns> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">The properties are not declared correctly.</exception> public CatelTypeInfo RegisterProperties(Type type) { Argument.IsNotNull("type", type); lock (_propertyDataLock) { if (_propertyData.ContainsKey(type)) { return(_propertyData[type]); } var catelTypeInfo = new CatelTypeInfo(type); _propertyData[type] = catelTypeInfo; return(catelTypeInfo); } }
/// <summary> /// Registers all the properties for the specified type. /// <para /> /// This method can only be called once per type. The <see cref="PropertyDataManager"/> caches /// whether it has already registered the properties once. /// </summary> /// <param name="type">The type to register the properties for.</param> /// <returns>The property data type info.</returns> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException">The properties are not declared correctly.</exception> public CatelTypeInfo RegisterProperties(Type type) { Argument.IsNotNull("type", type); lock (_propertyDataLock) { if (_propertyData.ContainsKey(type)) { return _propertyData[type]; } var catelTypeInfo = new CatelTypeInfo(type); _propertyData[type] = catelTypeInfo; return catelTypeInfo; } }
/// <summary> /// Unregisters a property for a specific type. /// </summary> /// <param name="type">The type for which to register the property.</param> /// <param name="name">The name of the property.</param> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">The <paramref name="name"/> is <c>null</c> or whitespace.</exception> public void UnregisterProperty(Type type, string name) { Argument.IsNotNullOrWhitespace("name", name); lock (_propertyDataLock) { if (!_propertyData.ContainsKey(type)) { _propertyData[type] = new CatelTypeInfo(type); } _propertyData[type].UnregisterProperty(name); } }