Ejemplo n.º 1
0
        public async Task Should_accept_a_completed_node()
        {
            var tracker = new NodeTracker <SimpleValue>(1000, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(60), () => DateTime.UtcNow);

            var observer = new NodeObserver();

            tracker.Connect(observer);

            var pendingValue     = new PendingValue <string, SimpleValue>("Hello", SimpleValueFactory.Healthy);
            var nodeValueFactory = new NodeValueFactory <SimpleValue>(pendingValue, 100);
            var node             = new FactoryNode <SimpleValue>(nodeValueFactory);

            tracker.Add(nodeValueFactory);

            var value = await node.Value;

            var observedNode = await observer.Value;

            Assert.That(observedNode, Is.InstanceOf <BucketNode <SimpleValue> >());
        }