public void SizeOf_reports_actual_size() { IFormatter target = new BinaryFormatter(); var testModel = new TestModel(); testModel.AddCustomer("Homer"); testModel.AddCustomer("Bart"); long actual = target.SizeOf(testModel); long expected = target.ToByteArray(testModel).Length; Trace.WriteLine("SizeOf(TestModel with 2 customers) using BinaryFormatter = " + expected); Assert.AreEqual(expected, actual); }