public void FromUTF8ByteArrayTest() { foreach (string s in SAMPLES) { byte[] utf8 = IRecordUtil.ToUTF8(s); string ret = IRecordUtil.FromUTF8(utf8); Assert.AreEqual(s, ret); } }
public void FromUTF8ByteArrayIntIntTest() { foreach (string s in SAMPLES) { byte[] tmp = IRecordUtil.ToUTF8(s); byte[] utf8 = new byte[tmp.Length + 2]; tmp.CopyTo(utf8, 1); string ret = IRecordUtil.FromUTF8(utf8, 1, tmp.Length - 1); Assert.AreEqual(s, ret); } }
public void IRGetVersionTest() { int retval; byte[] version; int versionSize = 0; retval = IRecordDll.IRGetVersion(ref versionSize, null); Assert.AreEqual(IRErrorCode.IRE_BUFFER_TOO_SHORT, (IRErrorCode)retval); version = new byte[versionSize]; retval = IRecordDll.IRGetVersion(ref versionSize, version); Assert.AreEqual(IRErrorCode.IRE_SUCCESS, (IRErrorCode)retval); Assert.AreEqual(versionSize - 1, IRecordUtil.CStringLength(version)); Assert.AreEqual("0.1.0.0", IRecordUtil.FromUTF8(version)); }