public void has_view_is_positive_with_always()
        {
            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<IViewToken>();
            node.AddView(viewToken);

            node.HasView(typeof(Always)).ShouldBeTrue();
        }
        public void has_view_is_positive_with_always()
        {
            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<ITemplateFile>();
            node.AddView(viewToken, null);

            node.HasView(Always.Flyweight).ShouldBeTrue();
        }
示例#3
0
        public void has_view_is_positive_with_always()
        {
            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <IViewToken>();

            node.AddView(viewToken);

            node.HasView(typeof(Always)).ShouldBeTrue();
        }
        public void has_view_is_positive_with_always()
        {
            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <ITemplateFile>();

            node.AddView(viewToken, null);

            node.HasView(Always.Flyweight).ShouldBeTrue();
        }
示例#5
0
        public void add_view()
        {
            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<IViewToken>();

            var viewNode = node.AddView(viewToken);
            node.Writers.ShouldContain(viewNode);

            viewNode.View.ShouldBeTheSameAs(viewToken);
        }
        public void has_view_positive_with_different_conditional()
        {
            Type conditionType = typeof(FakeConditional);

            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<IViewToken>();
            node.AddView(viewToken, conditionType);

            node.HasView(conditionType).ShouldBeTrue();
        }
        public void has_view_negative_when_there_is_a_view_but_it_has_different_conditions()
        {
            Type conditionType = typeof(FakeConditional);

            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<IViewToken>();
            node.AddView(viewToken, conditionType);

            node.HasView(typeof(Always)).ShouldBeFalse();
        }
        public void has_view_positive_with_different_conditional()
        {
            var condition = new FakeConditional();

            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<ITemplateFile>();
            node.AddView(viewToken);

            node.HasView().ShouldBeTrue();
        }
        public void has_view_negative_when_there_is_a_view_but_it_has_different_conditions()
        {
            var condition = new FakeConditional();

            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<ITemplateFile>();
            node.AddView(viewToken, condition);

            node.HasView(Always.Flyweight).ShouldBeFalse();
        }
示例#10
0
        public void has_view_negative_when_there_is_a_view_but_it_has_different_conditions()
        {
            var conditionType = typeof(FakeConditional);

            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <IViewToken>();

            node.AddView(viewToken, conditionType);

            node.HasView(typeof(Always)).ShouldBeFalse();
        }
示例#11
0
        public void has_view_positive_with_different_conditional()
        {
            var conditionType = typeof(FakeConditional);

            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <IViewToken>();

            node.AddView(viewToken, conditionType);

            node.HasView(conditionType).ShouldBeTrue();
        }
示例#12
0
        public void add_view()
        {
            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <IViewToken>();

            var viewNode = node.AddView(viewToken);

            node.Writers.ShouldContain(viewNode);

            viewNode.View.ShouldBeTheSameAs(viewToken);
        }
        public void has_view_positive_with_different_conditional()
        {
            var condition = new FakeConditional();

            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <ITemplateFile>();

            node.AddView(viewToken);

            node.HasView().ShouldBeTrue();
        }
示例#14
0
        public void has_view_negative_when_there_is_a_view_but_it_has_different_conditions()
        {
            var condition = new FakeConditional();

            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <ITemplateFile>();

            node.AddView(viewToken, condition);

            node.HasView(Always.Flyweight).ShouldBeFalse();
        }
        public void add_view_with_condition()
        {
            var node = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock<IViewToken>();
            viewToken.Stub(x => x.ViewModel).Return(typeof(Address));
            viewToken.Stub(x => x.ToViewFactoryObjectDef()).Return(
                ObjectDef.ForValue(MockRepository.GenerateMock<IViewFactory>()));

            var viewNode = node.AddView(viewToken, typeof(FakeConditional));

            viewNode.As<IContainerModel>().ToObjectDef()
                .FindDependencyDefinitionFor<IConditional>()
                .Type
                .ShouldEqual(typeof(FakeConditional));
        }
示例#16
0
        public void add_view_with_condition()
        {
            var node      = new OutputNode(typeof(Address));
            var viewToken = MockRepository.GenerateMock <IViewToken>();

            viewToken.Stub(x => x.ViewModel).Return(typeof(Address));
            viewToken.Stub(x => x.ToViewFactoryObjectDef()).Return(
                ObjectDef.ForValue(MockRepository.GenerateMock <IViewFactory>()));

            var viewNode = node.AddView(viewToken, typeof(FakeConditional));

            viewNode.As <IContainerModel>().ToObjectDef()
            .FindDependencyDefinitionFor <IConditional>()
            .Type
            .ShouldEqual(typeof(FakeConditional));
        }