public void RegisterComponentImplementationWithParameters() { MockXMLContainerBuilder containerBuilder = new MockXMLContainerBuilder(null); string xml = @"<component-implementation key='foo' type='BarClass'> <parameter key='param1'/> <parameter key='param2'/> </component-implementation>"; CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression(); CodeVariableReferenceExpression cvre = new CodeVariableReferenceExpression(); containerBuilder.CallRegisterComponentImplementation(ConvertToXml(xml), cmie, cvre); Assert.AreEqual(Constants.REGISTER_COMPONENT_IMPLEMENTATION, cmie.Method.MethodName); Assert.AreEqual(3, cmie.Parameters.Count); }
public void RegisterComponentImplementationWithKey() { MockXMLContainerBuilder containerBuilder = new MockXMLContainerBuilder(null); string xml = @"<component-implementation key='stringbuilder' type='System.Text.StringBuilder'/>"; CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression(); CodeVariableReferenceExpression cvre = new CodeVariableReferenceExpression(); containerBuilder.CallRegisterComponentImplementation(ConvertToXml(xml), cmie, cvre); Assert.AreEqual(Constants.REGISTER_COMPONENT_IMPLEMENTATION, cmie.Method.MethodName); Assert.AreEqual(2, cmie.Parameters.Count); }
public void RegisterComponentImplementationFailsWithoutClassAttribute() { MockXMLContainerBuilder containerBuilder = new MockXMLContainerBuilder(null); string xml = @"<component-implementation noclassattribute='xxx'/>"; CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression(); CodeVariableReferenceExpression cvre = new CodeVariableReferenceExpression(); containerBuilder.CallRegisterComponentImplementation(ConvertToXml(xml), cmie, cvre); }