public void ExpectedDocumentIsNull() { XmlDocument actual = new XmlDocument(); var constraint = new XmlDocumentEqualConstraint(null); Assert.That(constraint.Matches(actual), Is.False); }
public void CompareWithNullDocument() { XmlDocument expected = new XmlDocument(); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches((object)null), Is.False); }
public void CompareEmptyDocuments() { XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.True); }
public void CompareWithDocumentContainingOnlyRootNode() { XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); XmlElement actualRootNode = actual.CreateElement("root", "http://test"); actual.AppendChild(actualRootNode); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.False); }
public void CompareDifferentRootNodes() { string expectedXml = @"<rootA xmlns=""http://test"" />"; XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); expected.LoadXml(expectedXml); XmlElement actualRootNode = actual.CreateElement("rootB", "http://test"); actual.AppendChild(actualRootNode); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.False); }
public void CompareRootNodesWithSameValues() { string expectedXml = @"<root xmlns=""http://test"">Hello</root>"; XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); expected.LoadXml(expectedXml); XmlElement actualRootNode = actual.CreateElement("root", "http://test"); XmlText actualText = actual.CreateTextNode("Hello"); actualRootNode.AppendChild(actualText); actual.AppendChild(actualRootNode); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.True); }
public void CompareRootNodesWithSameAttributes() { string expectedXml = @"<root xmlns=""http://test"" name=""root"" />"; XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); expected.LoadXml(expectedXml); XmlElement actualRootNode = actual.CreateElement("root", "http://test"); XmlAttribute actualAttribute = actual.CreateAttribute("name"); actualAttribute.Value = "root"; actualRootNode.Attributes.Append(actualAttribute); actual.AppendChild(actualRootNode); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.True); }
public void CompareRootNodesWithDifferentAttributeValues() { XmlDocument expected = new XmlDocument(); XmlDocument actual = new XmlDocument(); XmlElement expectedRootNode = expected.CreateElement("root", "http://test"); XmlAttribute expectedAttribute = expected.CreateAttribute("name"); expectedAttribute.Value = "root"; expectedRootNode.Attributes.Append(expectedAttribute); expected.AppendChild(expectedRootNode); XmlElement actualRootNode = actual.CreateElement("root", "http://test"); XmlAttribute actualAttribute = actual.CreateAttribute("name"); actualAttribute.Value = "second"; actualRootNode.Attributes.Append(actualAttribute); actual.AppendChild(actualRootNode); var constraint = new XmlDocumentEqualConstraint(expected); Assert.That(constraint.Matches(actual), Is.False); }
public void ExpectedAndActualDocumentsAreNull() { var constraint = new XmlDocumentEqualConstraint(null); Assert.That(constraint.Matches((object)null), Is.True); }