public void TestBinaryFormatter() { var foo = new Foo { Bar = "BAR", Baz = "BAZ" }; var bytes = foo.GetBytes(); Assert.IsNotNull(bytes); Assert.AreNotEqual(0, bytes.Length); var foo2 = bytes.GetObject<Foo>(); Assert.IsNotNull(foo2); Assert.AreEqual("BAR", foo.Bar); Assert.AreEqual("BAZ", foo.Baz); }