Ejemplo n.º 1
0
        public void CanCreateAndRunFromView(ViewDefinition vd)
        {
            var snapshotManager = Context.MarketDataSnapshotManager;

            using (var proc = snapshotManager.CreateFromViewDefinition(vd.Name))
            {
                proc.Snapshot.Name = TestUtils.GetUniqueName();
                var uid = Context.MarketDataSnapshotMaster.Add(new MarketDataSnapshotDocument(null, proc.Snapshot)).UniqueId;

                try
                {
                    var snapOptions  = ExecutionOptions.Snapshot(proc.Snapshot.UniqueId);
                    var withSnapshot = GetFirstResult(snapOptions, vd.Name);

                    var options = ExecutionOptions.SingleCycle;
                    IViewComputationResultModel withoutSnapshot = GetFirstResult(options, vd.Name);

                    var withoutCount = CountResults(withoutSnapshot);
                    var withCount    = CountResults(withSnapshot);
                    if (withoutCount != withCount)
                    {
                        var withSpecs    = new HashSet <ValueSpecification>(withSnapshot.AllResults.Select(r => r.ComputedValue.Specification));
                        var withoutSpecs = new HashSet <ValueSpecification>(withoutSnapshot.AllResults.Select(r => r.ComputedValue.Specification));
                        withoutSpecs.SymmetricExceptWith(withSpecs);
                        Assert.True(false, string.Format("Running snapshot of {0} only had {1}, live had {2}", vd.Name, withCount, withoutCount));
                    }

                    Assert.Equal(withoutCount, withCount);
                }
                finally
                {
                    Context.MarketDataSnapshotMaster.Remove(uid);
                }
            }
        }
Ejemplo n.º 2
0
 private static bool CausesTick(Action <MarketDataSnapshotProcessor> action)
 {
     return(CausesTick(u => ExecutionOptions.Snapshot(u.ToLatest()), action));
 }
Ejemplo n.º 3
0
 protected override void AttachToViewProcess(RemoteViewClient remoteViewClient)
 {
     remoteViewClient.AttachToViewProcess(_viewDefinition.UniqueID, ExecutionOptions.Snapshot(_snapshotId));
 }