阅读背景:

我可以为一个方法创建一个单元测试,该方法从IntPtr中整理一个值吗?

来源:互联网 

I am using a native library which returns an IntPtr to a memory location, which contains the value of an attribute. I know what the type of the attribute is and I have a method for marshalling a value (taking the IntPtr and the type of the attribute) from the memory pointed at by the pointer. This method either calls Marshal.ReadInt32, or reads a series of bytes and converts them to a double, or reads a string with Marshal.PtrToStringUni etc etc. I would like to write some unit tests for this method but am not sure how I go about creating the IntPtr to pass to the method. I'm using NUnit and cannot use a mocking framework.I am using a native library which returns an In




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: