Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public Key(IMounter <TTarget, TProperty> item)
 {
     DeclaringType = item.DeclaringType;
     Name          = item.Name;
 }
Esempio n. 3
0
 protected override Key GetKeyForItem(IMounter <TTarget, TProperty> item)
 {
     return(new Key(item));
 }
Esempio n. 4
0
 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));
 }