public void Should_provide_a_clear_syntax_for_method_selection()
        {
            FooId <TestFeature> fooId = FooIds.Enabled <TestFeature>();

            fooId.If(() =>
            {
                // run if it is enabled
            });

            fooId.Unless(() =>
            {
                // run if disabled
            });

            fooId.If(() =>
            {
                /* enabled */
            }, () =>
            {
                /* disabled */
            });


            var result = fooId.Iff(() => 27, () => 42);

            Assert.AreEqual(27, result);

            var value = fooId.Iff((a, b) => a, (a, b) => b, 27, 42);

            Assert.AreEqual(27, value);
        }
Exemple #2
0
        public void Should_allow_simple_creation_of_dependent_fooids()
        {
            FooId <A>       a = FooIds.Enabled <A>();
            FooId <B>       b = FooIds.Enabled <B>();
            ToggleFooId <C> c = FooIds.Toggle <C>();

            FooId <ABC> abc = FooIds.Dependent <ABC>(x => x.Upon(a, b, c));

            Assert.IsFalse(abc.Enabled);

            c.Enable();
            Assert.IsTrue(abc.Enabled);
        }