Пример #1
0
        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");
        }
Пример #2
0
        public void VisitControllerNode_Always_CreatesType()
        {
            ControllerTreeNode node = new ControllerTreeNode("HomeController", "ControllerNamespace");

            _mocks.ReplayAll();
            _generator.Visit(node);
            _mocks.VerifyAll();

            CodeDomAssert.AssertHasProperty(_source.Ccu.Namespaces[0].Types[0], "MyActions");
            CodeDomAssert.AssertHasProperty(_source.Ccu.Namespaces[0].Types[0], "MyViews");
            CodeDomAssert.AssertHasProperty(_source.Ccu.Namespaces[0].Types[0], "MyRoutes");
            CodeDomAssert.AssertHasMethod(_source.Ccu.Namespaces[0].Types[0], "PerformGeneratedInitialize");
        }
Пример #3
0
        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");
        }
Пример #4
0
        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");
        }