public override void Visit(ViewTreeNode node) { if (typeStack.Count == 0) return; var constructionArguments = new CodeExpression[] { new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)), new CodeTypeOfExpression(node.Controller.FullName), new CodePrimitiveExpression(node.Controller.Area), new CodePrimitiveExpression(naming.ToControllerName(node.Controller.Name)), new CodePrimitiveExpression(node.Name) }; CodeExpression returnExpression = new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodePropertyReferenceExpression( new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), naming.ToMemberVariableName(serviceIdentifier)), "ControllerReferenceFactory"), "CreateViewReference"), constructionArguments); var propertyType = new CodeTypeReference(typeof (IControllerViewReference)); typeStack.Peek().Members.Add(source.CreateReadOnlyProperty(node.Name, propertyType, returnExpression)); base.Visit(node); }
public override void Visit(ViewTreeNode node) { if (_typeStack.Count == 0) { return; } CodeExpression[] constructionArguments = new CodeExpression[] { new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), _naming.ToMemberVariableName(_serviceIdentifier)), new CodeTypeOfExpression(node.Controller.FullName), new CodePrimitiveExpression(node.Controller.Area), new CodePrimitiveExpression(_naming.ToControllerName(node.Controller.Name)), new CodePrimitiveExpression(node.Name) }; CodeExpression returnExpression = new CodeMethodInvokeExpression( new CodeMethodReferenceExpression( new CodePropertyReferenceExpression( new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), _naming.ToMemberVariableName(_serviceIdentifier)), "ControllerReferenceFactory"), "CreateViewReference"), constructionArguments ); CodeTypeReference propertyType = new CodeTypeReference(typeof(IControllerViewReference)); _typeStack.Peek().Members.Add(_source.CreateReadOnlyProperty(node.Name, propertyType, returnExpression)); base.Visit(node); }
public void VisitViewNode_UnderNoController_DoesNothing() { ViewTreeNode node = new ViewTreeNode("Index"); _mocks.ReplayAll(); _generator.Visit(node); _mocks.VerifyAll(); }
public void VisitViewNode_UnderNoController_DoesNothing() { var node = new ViewTreeNode("Index"); mocks.ReplayAll(); generator.Visit(node); mocks.VerifyAll(); }
public void VisitViewNode_NoParameters_CreatesMethod() { var node = new ViewTreeNode("Index"); controller.AddChild(node); mocks.ReplayAll(); generator.Visit(controller); mocks.VerifyAll(); CodeDomAssert.AssertHasField(source.Ccu.Namespaces[0].Types[0], "_services"); CodeDomAssert.AssertHasProperty(source.Ccu.Namespaces[0].Types[0], "Index"); }
public void VisitViewNode_NoParameters_CreatesMethod() { ViewTreeNode node = new ViewTreeNode("Index"); _controller.AddChild(node); _mocks.ReplayAll(); _generator.Visit(_controller); _mocks.VerifyAll(); CodeDomAssert.AssertHasField(_source.Ccu.Namespaces[0].Types[0], "_services"); CodeDomAssert.AssertHasProperty(_source.Ccu.Namespaces[0].Types[0], "Index"); }
public void VisitViewNode_OneParameters_CreatesMethod() { var node = new ViewTreeNode("Index"); controller.AddChild(node); node.AddChild(new ParameterTreeNode("id", "System.Int32")); using (mocks.Unordered()) { } mocks.ReplayAll(); generator.Visit(controller); mocks.VerifyAll(); CodeDomAssert.AssertHasField(source.Ccu.Namespaces[0].Types[0], "_services"); CodeDomAssert.AssertHasProperty(source.Ccu.Namespaces[0].Types[0], "Index"); }
public void VisitViewNode_OneParameters_CreatesMethod() { ViewTreeNode node = new ViewTreeNode("Index"); _controller.AddChild(node); node.AddChild(new ParameterTreeNode("id", typeof(Int32))); using (_mocks.Unordered()) { } _mocks.ReplayAll(); _generator.Visit(_controller); _mocks.VerifyAll(); CodeDomAssert.AssertHasField(_source.Ccu.Namespaces[0].Types[0], "_services"); CodeDomAssert.AssertHasProperty(_source.Ccu.Namespaces[0].Types[0], "Index"); }
public void VisitViewNode_OneParameters_CreatesMethod() { var node = new ViewTreeNode("Index"); controller.AddChild(node); node.AddChild(new ParameterTreeNode("id", "System.Int32")); using (mocks.Unordered()) { } mocks.ReplayAll(); generator.Visit(controller); mocks.VerifyAll(); CodeDomAssert.AssertHasField(source.Ccu.Namespaces[0].Types[0], "_services"); CodeDomAssert.AssertHasProperty(source.Ccu.Namespaces[0].Types[0], "Index"); }
public virtual void Visit(ViewTreeNode node) { Accept(node.Children); }
public virtual void Visit(ViewTreeNode node) { Accept(node.Children); }