public void ByteList_TestConstuctors() { // Check out the default constructor ByteList myBytes = new ByteList(); Assert.IsNotNull(myBytes); Assert.AreEqual(0, myBytes.Length); // Check out the general constructor that take any number of objects // Case 1: A single boolean object myBytes = new ByteList(true); Assert.IsNotNull(myBytes); Assert.AreEqual(1, myBytes.Length); Assert.AreEqual(1, myBytes[0]); // Case 2: 3 different objects myBytes = new ByteList(true, 123, "Hello"); Assert.IsNotNull(myBytes); Assert.AreEqual(1 + 4 + (2 + 2 * 5), myBytes.Length); // Case 3: 3 strings of lengths 5, 5, and 52 myBytes = new ByteList("Hello", "There", "You amazing software developer and brilliant student"); Assert.IsNotNull(myBytes); Assert.AreEqual((2 + 2 * 5) + (2 + 2 * 5) + (2 + 2 * 52), myBytes.Length); // Case 4: with a bunch of other parameters types ByteList moreBytes = new ByteList(myBytes, (Int16)10, (Int64)20, (Single)30.0, (Double)40.0, new byte[] { 1, 2, 3 }); Assert.IsNotNull(moreBytes); Assert.AreEqual(myBytes.Length + 2 + 8 + 4 + 8 + 3, moreBytes.Length); byte[] bigArray = new byte[10000]; for (int i = 0; i < 10000; i++) { bigArray[i] = Convert.ToByte(i & 255); } ByteList bigList = new ByteList(bigArray); byte[] bigArray2 = bigList.GetBytes(8192); for (int i = 0; i < 8192; i++) { Assert.AreEqual(bigArray[i], bigArray2[i]); } }