示例#1
0
        public void SetUp()
        {
            // Set up sum view and a test child view
            var type = UnivariateStatisticsView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);

            var factory = new UnivariateStatisticsViewFactory();

            factory.EventType       = type;
            factory.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Price");
            _myView = new UnivariateStatisticsView(factory, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext());

            _childView = new SupportBeanClassView(typeof(SupportMarketDataBean));
            _myView.AddView(_childView);
        }
        public void TestCanReuse()
        {
            _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Price" }));
            _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, null);
            Assert.IsFalse(_factory.CanReuse(new FirstElementView(null)));
            EventType type = UnivariateStatisticsView.CreateEventType(SupportStatementContextFactory.MakeContext(), null, 1);
            UnivariateStatisticsViewFactory factoryOne = new UnivariateStatisticsViewFactory();

            factoryOne.EventType       = type;
            factoryOne.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Volume");
            UnivariateStatisticsViewFactory factoryTwo = new UnivariateStatisticsViewFactory();

            factoryTwo.EventType       = type;
            factoryTwo.FieldExpression = SupportExprNodeFactory.MakeIdentNodeMD("Price");
            Assert.IsFalse(_factory.CanReuse(new UnivariateStatisticsView(factoryOne, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
            Assert.IsTrue(_factory.CanReuse(new UnivariateStatisticsView(factoryTwo, SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext())));
        }
示例#3
0
 public void SetUp()
 {
     _container = SupportContainer.Reset();
     _factory   = new UnivariateStatisticsViewFactory();
 }
 public void SetUp()
 {
     _factory = new UnivariateStatisticsViewFactory();
 }
 /// <summary>
 /// Constructor requires the name of the field to use in the parent view to compute the statistics.
 /// </summary>
 /// <param name="viewFactory">The view factory.</param>
 /// <param name="agentInstanceContext">The agent instance context.</param>
 public UnivariateStatisticsView(UnivariateStatisticsViewFactory viewFactory, AgentInstanceViewFactoryChainContext agentInstanceContext)
 {
     this._viewFactory              = viewFactory;
     this._agentInstanceContext     = agentInstanceContext;
     this._fieldExpressionEvaluator = viewFactory.FieldExpression.ExprEvaluator;
 }