public void WriteSkypeContact() { string exceptionMes = string.Empty; Contact skypeContact = new SkypeContact(); Contact standard = new SkypeContact("Denchik", "Den4ik_Wi_n_e_r"); StreamWriter streamWriter = new StreamWriter("../../SkypeContactOutput.txt"); try { standard.Write(streamWriter); streamWriter.Close(); streamWriter.Dispose(); StreamReader streamReader = new StreamReader("../../SkypeContactOutput.txt"); skypeContact.Read(streamReader); streamReader.Close(); streamReader.Dispose(); } catch (ArgumentException mes) { exceptionMes = mes.Message; } Assert.AreEqual(skypeContact.Name, standard.Name); Assert.AreEqual(skypeContact.Data, standard.Data); Assert.AreEqual(exceptionMes, string.Empty); }
public void ReadSkypeContact() { string exceptionMes = string.Empty; Contact skypeContact = new SkypeContact(); Contact standard = new SkypeContact("Vasia", "pupkin_vasia1"); StreamReader stream = new StreamReader("../../SkypeContactInput.txt"); try { skypeContact.Read(stream); stream.Close(); stream.Dispose(); } catch (ArgumentException mes) { exceptionMes = mes.Message; } Assert.AreEqual(skypeContact.Name, standard.Name); Assert.AreEqual(skypeContact.Data, standard.Data); Assert.AreEqual(exceptionMes, string.Empty); }