public void ListEncode_PopulatedList_Positive() { BList inputList = new BList() { Value = new IBObject[] { new BInteger(9L), new BByteString() { Value = "spam".GetASCIIBytes() } } }; var expectedBytes = "li9e4:spame".GetASCIIBytes(); var outputStream = new MemoryStream(); var transform = new ListTransform(new BObjectTransform()); transform.Encode(inputList, outputStream); outputStream.Position = 0; var actualBytes = outputStream.ToArray(); Assert.IsTrue(expectedBytes.IsEqualWith(actualBytes), "Bytes returned does not match expected bytes"); }
public void ListEncode_NullListParam_Exception() { var outputStream = new MemoryStream(); var transform = new ListTransform(new BObjectTransform()); transform.Encode(null, outputStream); }
public void ListEncode_NullOutputStream_Exception() { BList inputList = new BList() { Value = new IBObject[] { } }; var transform = new ListTransform(new BObjectTransform()); transform.Encode(inputList, null); }
public void ListEncode_NestedList_Positive() { // A list with an empty list as it's only item: BList inputList = new BList() { Value = new IBObject[] { new BList() { Value = new IBObject[] { } } } }; var expectedBytes = "llee".GetASCIIBytes(); var outputStream = new MemoryStream(); var transform = new ListTransform(new BObjectTransform()); transform.Encode(inputList, outputStream); outputStream.Position = 0; var actualBytes = outputStream.ToArray(); Assert.IsTrue(expectedBytes.IsEqualWith(actualBytes), "Bytes returned does not match expected bytes"); }