public void WriteLogDeleteMethod()
        {
            WriteLogDelete log = ReturnMessage;

            log += IncrementCount;
            string result = log("Ay up!");

            Assert.Equal(3, count);
            Assert.Equal("Ay up!", result);
        }
示例#2
0
        public void WriteLogDeletePointToMethod()
        {
            WriteLogDelete log;

            // log = ReturnMessage
            log = new WriteLogDelete(ReturnMessage);
            // call the delegate and pass in the method you want to use with it
            // the method passed in needs to have a same looking args

            var result = log("Hello World");

            Assert.Equal("Hello World", result);
        }