public void AppendByteArraysTest() { byte[] bytes1 = null; byte[] bytes2 = null; Assert.Throws <NullReferenceException>(() => GeneralUtils.AppendByteArrays(bytes1, bytes2)); Assert.Throws <ArgumentNullException>(() => GeneralUtils.AppendByteArrays(null)); bytes1 = new byte[] { 1, 2, 3 }; bytes2 = new byte[] { 4, 5, 6 }; var bytes3 = GeneralUtils.AppendByteArrays(bytes1, bytes2); CollectionAssert.AreEqual(new byte[] { 1, 2, 3, 4, 5, 6 }, bytes3); }
public void AppendByteArraysNullTest() { byte[] bytes1 = null; byte[] bytes2 = null; try { GeneralUtils.AppendByteArrays(bytes1, bytes2); Assert.Fail("Should have thrown ArgumentNullException."); } catch (Exception) { //ignore } bytes1 = new byte[] { 1, 2, 3 }; bytes2 = new byte[] { 4, 5, 6 }; var bytes3 = GeneralUtils.AppendByteArrays(bytes1, bytes2); CollectionAssert.AreEqual(new byte[] { 1, 2, 3, 4, 5, 6 }, bytes3); }