Пример #1
0
        public void TestCanReuse()
        {
            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListBean(new Object[] { "TheString", "LongPrimitive" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportBean)),
                            SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
            Assert.IsFalse(
                _factory.CanReuse(
                    new GroupByViewImpl(
                        SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                        SupportExprNodeFactory.MakeIdentNodesBean(
                            "TheString"),
                        null)));
            Assert.IsTrue(
                _factory.CanReuse(
                    new GroupByViewImpl(
                        SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                        SupportExprNodeFactory.MakeIdentNodesBean(
                            "TheString", "LongPrimitive"),
                        null)));

            _factory.SetViewParameters(
                _viewFactoryContext,
                TestViewSupport.ToExprListBean(
                    new Object[] { SupportExprNodeFactory.MakeIdentNodesBean("TheString", "LongPrimitive") }));
            Assert.IsFalse(
                _factory.CanReuse(
                    new GroupByViewImpl(
                        SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                        SupportExprNodeFactory.MakeIdentNodesBean(
                            "TheString"),
                        null)));
            Assert.IsTrue(
                _factory.CanReuse(
                    new GroupByViewImpl(
                        SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(),
                        SupportExprNodeFactory.MakeIdentNodesBean(
                            "TheString", "LongPrimitive"),
                        null)));
        }