/// <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)); }
public void GenerateObjectNameWithNullRegistry() { Assert.Throws <ArgumentNullException>(() => ObjectDefinitionReaderUtils.GenerateObjectName(A.Fake <IConfigurableObjectDefinition>(), null)); }
public void GenerateObjectNameWithNullDefinition() { Assert.Throws <ArgumentNullException>(() => ObjectDefinitionReaderUtils.GenerateObjectName(null, registry)); }
public void GenerateObjectNameWithNullRegistry() { ObjectDefinitionReaderUtils.GenerateObjectName( (IConfigurableObjectDefinition)mocks.CreateMock(typeof(IConfigurableObjectDefinition)), null); }
public void GenerateObjectNameWithNullDefinition() { ObjectDefinitionReaderUtils.GenerateObjectName(null, registry); }
public void GenerateObjectNameWithNullRegistry() { ObjectDefinitionReaderUtils.GenerateObjectName(mocks.StrictMock <IConfigurableObjectDefinition>(), null); }