예제 #1
0
        private static PathDefinitionCollection CreatePathDefinitionCollection()
        {
            var viewProvider = SuspendableEventViewProvider.Create(new ObservableCollection <PathDefinition>(),
                                                                   new SuspendableObservableCollection <PathDefinition>());

            return(new PathDefinitionCollection(viewProvider));
        }
예제 #2
0
        public ModifierNodeCollection Create(FormNodeSelector selector)
        {
            var defaultView     = new NodeCollection <Modifier>();
            var suspendableView = new NodeCollection <Modifier>();
            var viewProvider    = SuspendableEventViewProvider.Create(defaultView, suspendableView);

            return(new ModifierNodeCollection(viewProvider));
        }
예제 #3
0
        private static ModifierNodeCollection CreateModifierNodeCollection()
        {
            var defaultView                = new NodeCollection <Modifier>();
            var suspendableView            = new NodeCollection <Modifier>();
            var nodeCollectionViewProvider = SuspendableEventViewProvider.Create(defaultView, suspendableView);

            return(new ModifierNodeCollection(nodeCollectionViewProvider));
        }
        public void CreateReturnsInstanceCalculatingSubscriberCountCorrectly(int defaultCount, int suspendableCount)
        {
            var defaultView     = Mock.Of <ICountsSubsribers>(o => o.SubscriberCount == defaultCount);
            var suspendableView = Mock.Of <ISuspendableCountsSubscribers>(o => o.SubscriberCount == suspendableCount);
            var provider        = SuspendableEventViewProvider.Create(defaultView, suspendableView);

            var actual = provider.SubscriberCount;

            Assert.AreEqual(defaultCount + suspendableCount, actual);
        }
        public void CreateReturnsCorrectInstance()
        {
            var defaultView     = Mock.Of <ICountsSubsribers>();
            var suspendableView = Mock.Of <ISuspendableCountsSubscribers>();

            var provider = SuspendableEventViewProvider.Create(defaultView, suspendableView);

            Assert.AreSame(defaultView, provider.DefaultView);
            Assert.AreSame(suspendableView, provider.SuspendableView);
            Assert.AreSame(suspendableView, provider.Suspender);
        }
예제 #6
0
        private static IStatGraph CreateStatGraph(
            TransformableNodeFactory nodeFactory, ValueTransformer valueTransformer, IStat stat)
        {
            var paths = new PathDefinitionCollection(SuspendableEventViewProvider.Create(
                                                         new ObservableCollection <PathDefinition>(), new SuspendableObservableCollection <PathDefinition>()));
            var coreGraph = new CoreStatGraph(new StatNodeFactory(nodeFactory, stat), paths);

            return(new StatGraphWithEvents(coreGraph, NodeAdded, NodeRemoved));

            void NodeAdded(NodeSelector selector)
            {
                var node          = coreGraph.Nodes[selector];
                var transformable = nodeFactory.TransformableDictionary[node];

                valueTransformer.AddTransformable(stat, selector, transformable);
            }

            void NodeRemoved(NodeSelector selector) => valueTransformer.RemoveTransformable(stat, selector);
        }
 private static PathDefinitionCollection CreateSut() =>
 new PathDefinitionCollection(SuspendableEventViewProvider.Create(new ObservableCollection <PathDefinition>(),
                                                                  new SuspendableObservableCollection <PathDefinition>()));
예제 #8
0
 private static ModifierNodeCollection CreateSut(
     NodeCollection <Modifier> defaultView, NodeCollection <Modifier> suspendableView) =>
 CreateSut(SuspendableEventViewProvider.Create(defaultView, suspendableView));