public WriteXML ( |
||
writer | ||
Результат | void |
public void SerializationTest() { string TestTaskName = "PickUpBook-HarryPotterAndTheChamberOfSecrets"; string TestTaskNote = "BooksAtLibrary"; AppTask GetBooks = new AppTask(TestTaskName, TestTaskNote, 0); GetBooks.RingTone = "Ringaling.wav"; XmlWriter writer = XmlWriter.Create("SerializationTest.xml"); writer.WriteStartDocument(); GetBooks.WriteXML(writer); writer.WriteEndDocument(); writer.Dispose(); XmlReader reader = XmlReader.Create("SerializationTest.xml"); reader.Read(); AppTask compareTask = new AppTask("", "", -1); compareTask.ReadXML(reader); reader.Dispose(); Assert.AreEqual(compareTask.TaskID, GetBooks.TaskID); Assert.AreEqual(compareTask.TaskName, GetBooks.TaskName); Assert.AreEqual(compareTask.TaskNotes, GetBooks.TaskNotes); Assert.AreEqual(compareTask.ReminderEnd, GetBooks.ReminderEnd); Assert.AreEqual(compareTask.RingTone, GetBooks.RingTone); Assert.AreEqual(compareTask.Done, GetBooks.Done); Assert.AreEqual(compareTask.Frequency, GetBooks.Frequency); Assert.AreEqual(compareTask.FrequencyUnit, GetBooks.FrequencyUnit); reader.Dispose(); }