示例#1
0
        private static void PredicateExample()
        {
            var exampleClass = new ExampleClass();
            var dateTester = new DateTester();
            var predicate = new TodayIsAnEvenDayOfTheMonthPredicate(dateTester);

            var component = new PredicatedComponent(exampleClass, predicate);

            component.Something();

            Console.ReadKey();
        }
示例#2
0
        private static void BranchedPredicateExample()
        {
            var trueClass = new TrueClass();
            var falseClass = new FalseClass();

            var dateTester = new DateTester();
            var predicate = new TodayIsAnEvenDayOfTheMonthPredicate(dateTester);

            var component = new BranchedComponent(trueClass, falseClass, predicate);

            component.Something();

            Console.ReadKey();
        }