public void XmlSer_testDeserialize_ReturnsCorrectProperties() { //arrange const string guid = "eb31d4ff-be0b-4366-9838-994ed803dd69"; const string title = "TestBezeichnung"; DateTime valutaDate = new DateTime(2010, 09, 10); const string type = "Quittungen"; const string notes = "TestStichwort"; DateTime entryDate = new DateTime(2020, 09, 10); const string username = "******"; MetadataItem testItem = new MetadataItem(guid, title, valutaDate, type, notes, entryDate, username); XmlSer des = new XmlSer(); des.SerializeFile(testItem, "Testordner\\Deserialisierung.xml"); //act MetadataItem result = des.DeserializeFile <MetadataItem>("Testordner\\Deserialisierung.xml"); //assert Assert.That(result, Is.TypeOf <MetadataItem>()); Assert.That(result.Guid, Is.EqualTo("eb31d4ff-be0b-4366-9838-994ed803dd69")); Assert.That(result.Title, Is.EqualTo("TestBezeichnung")); Assert.That(result.ValutaDate, Is.EqualTo(new DateTime(2010, 09, 10))); Assert.That(result.Type, Is.EqualTo("Quittungen")); Assert.That(result.Notes, Is.EqualTo("TestStichwort")); Assert.That(result.EntryDate, Is.EqualTo(new DateTime(2020, 09, 10))); Assert.That(result.Username, Is.EqualTo("TestBenutzer")); }
public void XmlSer_testDeserializeWithoutFile_ReturnsNull() { //arrange XmlSer des = new XmlSer(); //act MetadataItem result = des.DeserializeFile <MetadataItem>("Testordner"); //assert Assert.That(result, Is.Null); }