public void SerializationOfDeployInformation() { string tempDir = Environment.GetEnvironmentVariable("TEMP"); string tempFilename = Path.Combine(tempDir, "foo.dat"); FileInfo file = new FileInfo(tempFilename); FileStream instream = null; try { DeployInformation ex = new DeployInformation(new Application("testApp"), DeployStatus.CannotDeploy, new Exception("bar")); Stream outstream = file.OpenWrite(); new BinaryFormatter().Serialize(outstream, ex); outstream.Flush(); outstream.Close(); instream = file.OpenRead(); DeployInformation inex = (DeployInformation) new BinaryFormatter().Deserialize(instream); Assert.AreEqual(DeployStatus.CannotDeploy, inex.Status); Assert.AreEqual("testApp", inex.Application.Name); Assert.AreEqual("bar", inex.Error.Message); } finally { try { instream.Close(); file.Delete(); } catch {} } }
public void SerializationOfDeployInformation () { string tempDir = Environment.GetEnvironmentVariable("TEMP"); string tempFilename = Path.Combine(tempDir,"foo.dat"); FileInfo file = new FileInfo (tempFilename); FileStream instream = null; try { DeployInformation ex = new DeployInformation(new Application("testApp"), DeployStatus.CannotDeploy, new Exception("bar")); Stream outstream = file.OpenWrite (); new BinaryFormatter ().Serialize (outstream, ex); outstream.Flush (); outstream.Close (); instream = file.OpenRead (); DeployInformation inex = (DeployInformation) new BinaryFormatter ().Deserialize (instream); Assert.AreEqual(DeployStatus.CannotDeploy, inex.Status); Assert.AreEqual("testApp", inex.Application.Name); Assert.AreEqual("bar", inex.Error.Message); } finally { try { instream.Close (); file.Delete (); } catch {} } }