Exemplo n.º 1
0
        public void DynamicProxy_Should_Map_Instance_Method_Calls_To_The_Given_Instance()
        {
            const string instance = "TestString";
            dynamic proxy = new DynamicProxy(instance);

            char[] toCharArrayResult = proxy.ToCharArray();
            char[] toCharArrayIndexResult = proxy.ToCharArray(0, 4);

            var copyResult = new char[9];
            proxy.CopyTo(0, copyResult, 0, 9);

            Assert.AreEqual(instance, new string(toCharArrayResult));
            Assert.AreEqual(new string(instance.ToCharArray(0, 4)), new string(toCharArrayIndexResult));
            Assert.AreEqual(instance.Substring(0, 9), new string(copyResult));
        }