public void TestCanReuse() { _factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(new Object[] { "Symbol", "Feed" })); _factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(), null, _parents); Assert.IsFalse(_factory.CanReuse(new FirstElementView(null))); Assert.IsFalse(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), SupportExprNodeFactory.MakeIdentNodesMD("Symbol"), null, true))); Assert.IsTrue(_factory.CanReuse(new MergeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(), SupportExprNodeFactory.MakeIdentNodesMD("Symbol", "Feed"), null, true))); }
private void TryParameter(Object[] parameters, String[] fieldNames) { MergeViewFactory factory = new MergeViewFactory(); factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(parameters)); factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(_container), null, _parents); MergeView view = (MergeView)factory.MakeView(SupportStatementContextFactory.MakeAgentInstanceViewFactoryContext(_container)); Assert.AreEqual(fieldNames[0], view.GroupFieldNames[0].ToExpressionStringMinPrecedenceSafe()); if (fieldNames.Length > 0) { Assert.AreEqual(fieldNames[1], view.GroupFieldNames[1].ToExpressionStringMinPrecedenceSafe()); } }
private void TryInvalidParameter(Object[] parameters) { try { MergeViewFactory factory = new MergeViewFactory(); factory.SetViewParameters(_viewFactoryContext, TestViewSupport.ToExprListMD(parameters)); factory.Attach(SupportEventTypeFactory.CreateBeanType(typeof(SupportMarketDataBean)), SupportStatementContextFactory.MakeContext(_container), null, _parents); Assert.Fail(); } catch (ViewParameterException) { // expected } }