Ejemplo n.º 1
0
 public void TestCanReuse()
 {
     _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
     Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
     Assert.IsFalse(_factory.CanReuse(new LengthBatchView(null, _factory, 1, null)));
     Assert.IsTrue(_factory.CanReuse(new LengthBatchView(null, _factory, 1000, null)));
 }
        public void TestCanReuse()
        {
            AgentInstanceContext agentInstanceContext = SupportStatementContextFactory.MakeAgentInstanceContext(_container);

            _factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(new Object[] { 1000 }));
            Assert.False(_factory.CanReuse(new FirstElementView(null), agentInstanceContext));
            Assert.False(_factory.CanReuse(new LengthBatchView(null, _factory, 1, null), agentInstanceContext));
            Assert.True(_factory.CanReuse(new LengthBatchView(null, _factory, 1000, null), agentInstanceContext));
        }
        private void TryParameter(Object[] param, int size)
        {
            var factory = new LengthBatchViewFactory();

            factory.SetViewParameters(SupportStatementContextFactory.MakeViewContext(_container), TestViewSupport.ToExprListBean(param));
            var view = (LengthBatchView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container));

            Assert.AreEqual(size, view.Size);
        }