コード例 #1
0
        /// <summary>
        /// Generates an object name for the given object definition.
        /// </summary>
        /// <param name="definition">The object definition to generate a name for.</param>
        /// <param name="registry">The object definitions registry that the given definition is
        /// supposed to be registerd with</param>
        /// <returns>the generated object name</returns>
        public string GenerateObjectName(IObjectDefinition definition, IObjectDefinitionRegistry registry)
        {
            IConfigurableObjectDefinition objectDef = definition as IConfigurableObjectDefinition;

            if (objectDef == null)
            {
                throw new ArgumentException(
                          "DefaultObjectNameGenerator is only able to handle IConfigurableObjectDefinition subclasses: " +
                          definition);
            }
            return(ObjectDefinitionReaderUtils.GenerateObjectName(objectDef, registry));
        }
コード例 #2
0
 public void GenerateObjectNameWithNullRegistry()
 {
     Assert.Throws <ArgumentNullException>(() => ObjectDefinitionReaderUtils.GenerateObjectName(A.Fake <IConfigurableObjectDefinition>(), null));
 }
コード例 #3
0
 public void GenerateObjectNameWithNullDefinition()
 {
     Assert.Throws <ArgumentNullException>(() => ObjectDefinitionReaderUtils.GenerateObjectName(null, registry));
 }
コード例 #4
0
 public void GenerateObjectNameWithNullRegistry()
 {
     ObjectDefinitionReaderUtils.GenerateObjectName(
         (IConfigurableObjectDefinition)mocks.CreateMock(typeof(IConfigurableObjectDefinition)),
         null);
 }
コード例 #5
0
 public void GenerateObjectNameWithNullDefinition()
 {
     ObjectDefinitionReaderUtils.GenerateObjectName(null, registry);
 }
コード例 #6
0
 public void GenerateObjectNameWithNullRegistry()
 {
     ObjectDefinitionReaderUtils.GenerateObjectName(mocks.StrictMock <IConfigurableObjectDefinition>(), null);
 }