示例#1
0
        public void Apply_WhenNull()
        {
            var target = new ReverseBehavior();
            var result = target.Apply(null);

            Assert.AreEqual(String.Empty, result);
        }
示例#2
0
        public void Apply()
        {
            const string someText = "someText";
            var          target   = new ReverseBehavior();
            var          result   = target.Apply(someText);

            Assert.AreEqual(someText.Reverse(), result);
        }
示例#3
0
        public static void Main(string[] args)
        {
            var reverser           = new ReverseBehavior();
            var exceptionDecorator = new ExceptionDecorator(reverser);
            var loggingDecorator   = new LoggingDecorator(exceptionDecorator);
            var threadingDecorator = new ThreadingDecorator(loggingDecorator);
            var timerDecorator     = new TimerDecorator(threadingDecorator);
            //var nullDecorator = new NullDecorator(timerDecorator);

            var result = timerDecorator.Apply("abc");

            Console.WriteLine(result);

            Console.ReadKey();
        }