Модульный тест проверяет, соответствует ли фактическая выходная строка из XmlSerializer ожидаемой.
Код: Выделить всё
string expectedXmlText = File.ReadAllText("TestFile.xml");
objectToSerialize = ...;
string actual = UtilsClass.SerializeObject(objectToSerialize);
Assert.That(xmlText, Is.EqualTo(expectedXmlText));
Код: Выделить всё
Test(s) failed. String lengths are both 476. Strings differ at index 59.
Expected: "..."utf-16"?>\r\n