public void TestSerialize() { using (var stream = new MemoryStream()) { var excel = new ExcelAssignment(); var wb = TestData.CreateWorkbookProperties(); excel.Serialize(stream, TestData.AssignmentData, "Worksheet Tab Name", wb); stream.Flush(); stream.Position = 0; // The size changes all the time! // Assert.AreEqual(9149, stream.Position, "Serialized byte count are equal."); } }
public void TestDeserialize() { using (var stream = new MemoryStream()) { var excel = new ExcelAssignment(); var wb = TestData.CreateWorkbookProperties(); excel.Serialize(stream, TestData.AssignmentData, "Worksheet Tab Name", wb); stream.Flush(); stream.Position = 0; var wb2 = new WorkbookProperties(); string[,] result = excel.Deserialize(stream, wb2); stream.Position = 0; Assert.IsTrue(result == null, "Serialize/Deserialize Assignment round trip"); ChangeExcelValues(stream); wb2 = new WorkbookProperties(); result = excel.Deserialize(stream, wb2); Assert.IsTrue(result[2, 3] == "O", "Removed Assignment"); Assert.IsTrue(result[2, 4] == "X", "Added Assignment"); } }