Example #1
0
        public void IsValid_ExpectedBehavior()
        {
            var ctx  = new MyContext();
            var task = new PrimitiveTask <byte>()
            {
                Name = "Test"
            };

            task.AddCondition(new FuncCondition <MyContext, byte>("Done == false", context => context.Done == false));
            var expectTrue = task.IsValid(ctx);

            task.AddCondition(new FuncCondition <MyContext, byte>("Done == true", context => context.Done == true));
            var expectFalse = task.IsValid(ctx);

            Assert.IsTrue(expectTrue);
            Assert.IsFalse(expectFalse);
        }
Example #2
0
        public void AddCondition_ExpectedBehavior()
        {
            var task = new PrimitiveTask <byte>()
            {
                Name = "Test"
            };
            var t = task.AddCondition(new FuncCondition <MyContext, byte>("TestCondition", context => context.Done == false));

            Assert.IsTrue(t == task);
            Assert.IsTrue(task.Conditions.Count == 1);
        }