Exemplo n.º 1
0
        public void ActionDelegateTest()
        {
            //var delegatorObject = new Delegator();
            var             calleeObject = new Callee("Hello");
            Action <string> adg          = calleeObject.ReplaceImage;

            //delegatorObject.ActionProcess("Change", adg);
            adg("Change");
            Xunit.Assert.Equal("Change", calleeObject.GetImage());
        }
Exemplo n.º 2
0
        public void DelegatesTest()
        {
            var delegatorObject = new Delegator();
            var calleeObject    = new Callee("Hello");

            Delegator.ImageDelegator imgd = calleeObject.DoubleImage;
            imgd += calleeObject.ReverseImage;
            delegatorObject.Process(imgd);
            Xunit.Assert.NotEqual("HelloHello", calleeObject.GetImage());
        }