private void Register(IMounter <TTarget, TProperty> item) { Type targetType = item.ParentType; if (_resultRegistrations.ContainsKey(targetType)) { throw new InvalidOperationException(DiagnosticMessages.MounterManager_RegisterAfterUse(targetType.FullName)); } RegistrationCollection registrations = _registrations.GetOrAdd(targetType, x => new RegistrationCollection()); if (registrations.Contains(new Key(item))) { throw new InvalidOperationException(DiagnosticMessages.MounterManager_RegisterDuplicate(item.DeclaringType.FullName, item.Name)); } registrations.Add(item); }
public Key(IMounter <TTarget, TProperty> item) { DeclaringType = item.DeclaringType; Name = item.Name; }
protected override Key GetKeyForItem(IMounter <TTarget, TProperty> item) { return(new Key(item)); }
void VerifyProperty(IMounter <TargetType, PropertyType> property, Type expectedDeclaringType, string expectedName, Type expectedTargetType, Type expectedPropertyType) { Assert.AreEqual(expectedDeclaringType, property.DeclaringType, string.Format("The owner type should be '{0}'", expectedDeclaringType)); }