Exemple #1
0
        public void ApplySimpleValueToPlaceHolder()
        {
            PlaceHolderNode <int> node  = new PlaceHolderNode <int>("answer", new int[0]);
            INode <int>           value = Flow.Constant(42);

            Context context = new Context();

            context.SetNode("answer", value);

            Assert.IsTrue(node.ApplyContext(context));
            Assert.AreEqual(42, node.GetValue(0));
        }
Exemple #2
0
        public void UnknownPlaceholder()
        {
            PlaceHolderNode <int> node  = new PlaceHolderNode <int>("answer", new int[1]);
            INode <int>           value = Flow.Constant(42);

            Context context = new Context();

            try
            {
                node.ApplyContext(context);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(InvalidOperationException));
                Assert.AreEqual("Unknown placeholder 'answer'", ex.Message);
            }
        }