public void Serialize_IfAnEntryHasAnEmptyName_ShouldSerializeProperly() { var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Entries.Add(string.Empty, new SerializableLocalizationEntry()); Assert.AreEqual("<node><entry name=\"\" /></node>", this.XmlSerialize(serializableLocalizationNode)); }
public void Serialize_IfANodeHasAWhitespaceName_ShouldThrowAnInvalidOperationException() { var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Nodes.Add(new SerializableLocalizationNode { NameInternal = " " }); this.XmlSerialize(serializableLocalizationNode); }
public void Serialize_IfANodeHasAnEmptyName_ShouldThrowAnInvalidOperationException() { var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Nodes.Add(new SerializableLocalizationNode { NameInternal = string.Empty }); this.XmlSerialize(serializableLocalizationNode); }
public void Serialize_IfTheEntriesContainsAnEntryWithAnInvalidNameAsXmlName_ShouldSerializeProperly() { var serializableLocalizationEntry = new SerializableLocalizationEntry { Value = "Entry-value" }; var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Entries.Add("Invalid-xml-element-name", serializableLocalizationEntry); Assert.AreEqual("<node><entry name=\"Invalid-xml-element-name\">Entry-value</entry></node>", this.XmlSerialize(serializableLocalizationNode)); }
public void Serialize_IfTheEntriesContainsAnEntryWithAValidNameAsXmlName_ShouldSerializeProperly() { var serializableLocalizationEntry = new SerializableLocalizationEntry { Value = "Entry-value" }; var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Entries.Add("Valid_Name", serializableLocalizationEntry); Assert.AreEqual("<node><valid_Name>Entry-value</valid_Name></node>", this.XmlSerialize(serializableLocalizationNode)); }
public void Serialize_IfTheEntriesAndNodesAreNotEmpty_ShouldSerializeProperly() { var serializableLocalizationEntry = new SerializableLocalizationEntry { Value = "Entry-value" }; var serializableLocalizationNode = new SerializableLocalizationNode(); serializableLocalizationNode.Entries.Add("Invalid-xml-element-name", serializableLocalizationEntry); serializableLocalizationNode.Nodes.Add(new SerializableLocalizationNode { NameInternal = "MyNode" }); Assert.AreEqual("<node><myNode /><entry name=\"Invalid-xml-element-name\">Entry-value</entry></node>", this.XmlSerialize(serializableLocalizationNode)); }
public void Serialize_IfTheEntriesAndNodesAreEmpty_ShouldSerializeProperly() { var serializableLocalizationNode = new SerializableLocalizationNode(); Assert.AreEqual("<node />", this.XmlSerialize(serializableLocalizationNode)); }