Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5222 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
22 changed files with 734 additions and 300 deletions
@ -1,121 +1,139 @@
@@ -1,121 +1,139 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.XmlEditor |
||||
{ |
||||
/// <summary>
|
||||
/// A collection that stores <see cref='QualifiedName'/> objects.
|
||||
/// </summary>
|
||||
[Serializable()] |
||||
public class QualifiedNameCollection : Collection<QualifiedName> { |
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref='QualifiedNameCollection'/>.
|
||||
/// </summary>
|
||||
public class QualifiedNameCollection : Collection<QualifiedName> |
||||
{ |
||||
public QualifiedNameCollection() |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref='QualifiedNameCollection'/> based on another <see cref='QualifiedNameCollection'/>.
|
||||
/// </summary>
|
||||
/// <param name='val'>
|
||||
/// A <see cref='QualifiedNameCollection'/> from which the contents are copied
|
||||
/// </param>
|
||||
public QualifiedNameCollection(QualifiedNameCollection val) |
||||
public QualifiedNameCollection(QualifiedNameCollection names) |
||||
{ |
||||
this.AddRange(val); |
||||
AddRange(names); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref='QualifiedNameCollection'/> containing any array of <see cref='QualifiedName'/> objects.
|
||||
/// </summary>
|
||||
/// <param name='val'>
|
||||
/// A array of <see cref='QualifiedName'/> objects with which to intialize the collection
|
||||
/// </param>
|
||||
public QualifiedNameCollection(QualifiedName[] val) |
||||
public QualifiedNameCollection(QualifiedName[] names) |
||||
{ |
||||
this.AddRange(val); |
||||
AddRange(names); |
||||
} |
||||
|
||||
public bool HasItems { |
||||
get { return Count > 0; } |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
string text = String.Empty; |
||||
|
||||
for (int i = 0; i < this.Count; i++) { |
||||
text += (i == 0) ? this[i] + "" : " > " + this[i]; |
||||
StringBuilder text = new StringBuilder(); |
||||
for (int i = 0; i < Count; i++) { |
||||
if (i > 0) { |
||||
text.Append(" > "); |
||||
} |
||||
text.Append(this[i].ToString()); |
||||
} |
||||
|
||||
return text; |
||||
return text.ToString(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Copies the elements of an array to the end of the <see cref='QualifiedNameCollection'/>.
|
||||
/// </summary>
|
||||
/// <param name='val'>
|
||||
/// An array of type <see cref='QualifiedName'/> containing the objects to add to the collection.
|
||||
/// </param>
|
||||
/// <seealso cref='QualifiedNameCollection.Add'/>
|
||||
public void AddRange(QualifiedName[] val) |
||||
public void AddRange(QualifiedName[] names) |
||||
{ |
||||
for (int i = 0; i < val.Length; i++) { |
||||
this.Add(val[i]); |
||||
for (int i = 0; i < names.Length; i++) { |
||||
Add(names[i]); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds the contents of another <see cref='QualifiedNameCollection'/> to the end of the collection.
|
||||
/// </summary>
|
||||
/// <param name='val'>
|
||||
/// A <see cref='QualifiedNameCollection'/> containing the objects to add to the collection.
|
||||
/// </param>
|
||||
/// <seealso cref='QualifiedNameCollection.Add'/>
|
||||
public void AddRange(QualifiedNameCollection val) |
||||
public void AddRange(QualifiedNameCollection names) |
||||
{ |
||||
for (int i = 0; i < val.Count; i++) { |
||||
this.Add(val[i]); |
||||
for (int i = 0; i < names.Count; i++) { |
||||
Add(names[i]); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes the last item in this collection.
|
||||
/// </summary>
|
||||
public void RemoveLast() |
||||
{ |
||||
if (Count > 0) { |
||||
if (HasItems) { |
||||
RemoveAt(Count - 1); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes the first item in the collection.
|
||||
/// </summary>
|
||||
public void RemoveFirst() |
||||
{ |
||||
if (Count > 0) { |
||||
if (HasItems) { |
||||
RemoveFirst(1); |
||||
} |
||||
} |
||||
|
||||
public void RemoveFirst(int howMany) |
||||
{ |
||||
if (howMany > Count) { |
||||
howMany = Count; |
||||
} |
||||
|
||||
while (howMany > 0) { |
||||
RemoveAt(0); |
||||
--howMany; |
||||
} |
||||
} |
||||
|
||||
public string GetLastPrefix() |
||||
{ |
||||
if (HasItems) { |
||||
QualifiedName name = this[Count - 1]; |
||||
return name.Prefix; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the namespace prefix of the last item.
|
||||
/// </summary>
|
||||
public string LastPrefix { |
||||
get { |
||||
if (Count > 0) { |
||||
QualifiedName name = this[Count - 1]; |
||||
return name.Prefix; |
||||
public string GetNamespaceForPrefix(string prefix) |
||||
{ |
||||
foreach (QualifiedName name in this) { |
||||
if (name.Prefix == prefix) { |
||||
return name.Namespace; |
||||
} |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
public QualifiedName GetLast() |
||||
{ |
||||
if (HasItems) { |
||||
return this[Count - 1]; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public override int GetHashCode() |
||||
{ |
||||
return base.GetHashCode(); |
||||
} |
||||
|
||||
public override bool Equals(object obj) |
||||
{ |
||||
QualifiedNameCollection rhs = obj as QualifiedNameCollection; |
||||
if (rhs != null) { |
||||
if (Count == rhs.Count) { |
||||
for (int i = 0; i < Count; ++i) { |
||||
QualifiedName lhsName = this[i]; |
||||
QualifiedName rhsName = rhs[i]; |
||||
if (!lhsName.Equals(rhsName)) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.XmlEditor; |
||||
using NUnit.Framework; |
||||
|
||||
namespace XmlEditor.Tests.Paths |
||||
{ |
||||
[TestFixture] |
||||
public class QualifiedNameCollectionEqualsTests |
||||
{ |
||||
QualifiedNameCollection lhs; |
||||
QualifiedNameCollection rhs; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
lhs = new QualifiedNameCollection(); |
||||
rhs = new QualifiedNameCollection(); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyCollectionsAreEqual() |
||||
{ |
||||
Assert.IsTrue(lhs.Equals(rhs)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullIsNotEqualToCollection() |
||||
{ |
||||
Assert.IsFalse(lhs.Equals(null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void EqualReturnsFalseWhenOneCollectionHasAnItemAndTheOtherDoesNot() |
||||
{ |
||||
lhs.Add(new QualifiedName("root", "ns", "a")); |
||||
Assert.IsFalse(lhs.Equals(rhs)); |
||||
} |
||||
|
||||
[Test] |
||||
public void EqualsReturnsFalseWhenQualifiedNamesAreDifferent() |
||||
{ |
||||
lhs.Add(new QualifiedName("name1", "ns1", "prefix1")); |
||||
rhs.Add(new QualifiedName("name2", "ns2", "prefix2")); |
||||
Assert.IsFalse(lhs.Equals(rhs)); |
||||
} |
||||
|
||||
[Test] |
||||
public void EqualsReturnsTrueWhenQualifiedNamesHaveSameNameAndNamespaceButDifferentPrefix() |
||||
{ |
||||
lhs.Add(new QualifiedName("name", "ns", "prefix1")); |
||||
rhs.Add(new QualifiedName("name", "ns", "prefix2")); |
||||
Assert.IsTrue(lhs.Equals(rhs)); |
||||
} |
||||
|
||||
[Test] |
||||
public void EqualsReturnsFalseWhenQualifiedNamesHaveSameNameButDifferentNamespace() |
||||
{ |
||||
lhs.Add(new QualifiedName("name", "ns1", "prefix")); |
||||
rhs.Add(new QualifiedName("name", "ns2", "prefix")); |
||||
Assert.IsFalse(lhs.Equals(rhs)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,147 @@
@@ -0,0 +1,147 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.XmlEditor; |
||||
using NUnit.Framework; |
||||
|
||||
namespace XmlEditor.Tests.Paths |
||||
{ |
||||
[TestFixture] |
||||
public class QualifiedNameCollectionTests |
||||
{ |
||||
QualifiedName firstName; |
||||
QualifiedName secondName; |
||||
QualifiedNameCollection qualifiedNameCollection; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
firstName = new QualifiedName("first", "first-ns", "first-prefix"); |
||||
secondName = new QualifiedName("second", "second-ns", "second-prefix"); |
||||
|
||||
QualifiedName[] array = new QualifiedName[] { firstName, secondName }; |
||||
qualifiedNameCollection = new QualifiedNameCollection(array); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateQualifiedNameCollectionInstanceUsingQualifiedNameArray() |
||||
{ |
||||
Assert.AreSame(secondName, qualifiedNameCollection[1]); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateQualifiedNameCollectionInstanceUsingQualifiedNameCollection() |
||||
{ |
||||
QualifiedName[] array = new QualifiedName[] { firstName, secondName }; |
||||
QualifiedNameCollection oldCollection = new QualifiedNameCollection(array); |
||||
QualifiedNameCollection newCollection = new QualifiedNameCollection(oldCollection); |
||||
|
||||
Assert.AreSame(firstName, newCollection[0]); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveFirstItemFromCollectionRemovesFirstName() |
||||
{ |
||||
qualifiedNameCollection.RemoveFirst(); |
||||
Assert.AreSame(secondName, qualifiedNameCollection[0]); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveFirstItemFromEmptyCollectionDoesNotThrowArgumentOutOfRangeException() |
||||
{ |
||||
qualifiedNameCollection = new QualifiedNameCollection(); |
||||
qualifiedNameCollection.RemoveFirst(); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveLastItemFromCollectionRemovesLastName() |
||||
{ |
||||
qualifiedNameCollection.RemoveLast(); |
||||
Assert.AreEqual(1, qualifiedNameCollection.Count); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveLastItemFromCollectionLeavesFirstName() |
||||
{ |
||||
RemoveLastItemFromCollectionRemovesLastName(); |
||||
Assert.AreSame(firstName, qualifiedNameCollection[0]); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveLastItemFromEmptyCollectionDoesNotThrowArgumentOutOfRangeException() |
||||
{ |
||||
qualifiedNameCollection = new QualifiedNameCollection(); |
||||
qualifiedNameCollection.RemoveLast(); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetLastPrefixReturnsPrefixFromLastQualifiedNameInCollection() |
||||
{ |
||||
Assert.AreEqual("second-prefix", qualifiedNameCollection.GetLastPrefix()); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetLastPrefixFromEmptyCollectionDoesNotThrowArgumentOutOfRangeException() |
||||
{ |
||||
qualifiedNameCollection = new QualifiedNameCollection(); |
||||
Assert.AreEqual(String.Empty, qualifiedNameCollection.GetLastPrefix()); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetNamespaceForPrefixFindsCorrectNamespaceForFirstName() |
||||
{ |
||||
Assert.AreEqual("first-ns", qualifiedNameCollection.GetNamespaceForPrefix("first-prefix")); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetNamespaceForPrefixForUnknownPrefixReturnsEmptyString() |
||||
{ |
||||
Assert.AreEqual(String.Empty, qualifiedNameCollection.GetNamespaceForPrefix("a")); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetLastReturnsLastQualifiedNameInCollection() |
||||
{ |
||||
Assert.AreSame(secondName, qualifiedNameCollection.GetLast()); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetLastReturnsNullWhenCollectionIsEmpty() |
||||
{ |
||||
qualifiedNameCollection = new QualifiedNameCollection(); |
||||
Assert.IsNull(qualifiedNameCollection.GetLast()); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedNameCollectionHasItems() |
||||
{ |
||||
Assert.IsTrue(qualifiedNameCollection.HasItems); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyQualifiedNameCollectionHasNoItems() |
||||
{ |
||||
qualifiedNameCollection = new QualifiedNameCollection(); |
||||
Assert.IsFalse(qualifiedNameCollection.HasItems); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemoveFirstTwoItemsClearsEntireCollection() |
||||
{ |
||||
qualifiedNameCollection.RemoveFirst(2); |
||||
Assert.AreEqual(0, qualifiedNameCollection.Count); |
||||
} |
||||
|
||||
[Test] |
||||
public void RemovingMoreItemsThanInCollectionDoesNotThrowArgumentOutOfRangeException() |
||||
{ |
||||
qualifiedNameCollection.RemoveFirst(5); |
||||
Assert.AreEqual(0, qualifiedNameCollection.Count); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.XmlEditor; |
||||
using NUnit.Framework; |
||||
|
||||
namespace XmlEditor.Tests.Paths |
||||
{ |
||||
[TestFixture] |
||||
public class QualifiedNameCollectionToStringTests |
||||
{ |
||||
QualifiedNameCollection qualifiedNames; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
qualifiedNames = new QualifiedNameCollection(); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyCollectionToStringReturnsEmptyString() |
||||
{ |
||||
Assert.AreEqual(String.Empty, qualifiedNames.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void OneItemInCollectionReturnsQualifiedNameInToString() |
||||
{ |
||||
qualifiedNames.Add(new QualifiedName("root", "ns", "a")); |
||||
Assert.AreEqual("a:root [ns]", qualifiedNames.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void TwoItemsInCollectionReturnsTwoQualifiedNamesInToString() |
||||
{ |
||||
qualifiedNames.Add(new QualifiedName("root1", "ns1", "a1")); |
||||
qualifiedNames.Add(new QualifiedName("root2", "ns2", "a2")); |
||||
Assert.AreEqual("a1:root1 [ns1] > a2:root2 [ns2]", qualifiedNames.ToString()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,177 @@
@@ -0,0 +1,177 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.XmlEditor; |
||||
using NUnit.Framework; |
||||
|
||||
namespace XmlEditor.Tests.Paths |
||||
{ |
||||
[TestFixture] |
||||
public class QualifiedNameTests |
||||
{ |
||||
[Test] |
||||
public void GetPrefixedNameWithNoPrefixReturnsName() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "namespace"); |
||||
Assert.AreEqual("root", name.GetPrefixedName()); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetPrefixedNameWithPrefixReturnsPrefixAndName() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "namespace", "a"); |
||||
Assert.AreEqual("a:root", name.GetPrefixedName()); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyQualifiedNameGetPrefixedNameReturnsEmptyString() |
||||
{ |
||||
QualifiedName name = new QualifiedName(); |
||||
Assert.AreEqual(String.Empty, name.GetPrefixedName()); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasNamespaceReturnsTrueForNonEmptyNamespace() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "namespace"); |
||||
Assert.IsTrue(name.HasNamespace); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsEmptyReturnsTrueForEmptyNameAndNamespaceAndPrefix() |
||||
{ |
||||
QualifiedName name = new QualifiedName(); |
||||
Assert.IsTrue(name.IsEmpty); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsEmptyReturnsFalseForNonEmptyName() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", String.Empty); |
||||
Assert.IsFalse(name.IsEmpty); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsEmptyReturnsFalseForNonEmptyNamespace() |
||||
{ |
||||
QualifiedName name = new QualifiedName(String.Empty, "ns"); |
||||
Assert.IsFalse(name.IsEmpty); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsEmptyReturnsFalseForNonEmptyNamespacePrefix() |
||||
{ |
||||
QualifiedName name = new QualifiedName(String.Empty, String.Empty, "a"); |
||||
Assert.IsFalse(name.IsEmpty); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyQualifiedNameReturnsEmptyStringForName() |
||||
{ |
||||
QualifiedName name = new QualifiedName(); |
||||
Assert.AreEqual(String.Empty, name.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyQualifiedNameReturnsEmptyStringForNamespace() |
||||
{ |
||||
QualifiedName name = new QualifiedName(); |
||||
Assert.AreEqual(String.Empty, name.Namespace); |
||||
} |
||||
|
||||
[Test] |
||||
public void EmptyQualifiedNameReturnsEmptyStringForNamespacePrefix() |
||||
{ |
||||
QualifiedName name = new QualifiedName(); |
||||
Assert.AreEqual(String.Empty, name.Prefix); |
||||
} |
||||
|
||||
[Test] |
||||
public void NamePropertyReturnsCorrectName() |
||||
{ |
||||
QualifiedName name = new QualifiedName("a", "ns"); |
||||
Assert.AreEqual("a", name.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void NamespacePropertyReturnsCorrectNamespace() |
||||
{ |
||||
QualifiedName name = new QualifiedName("a", "ns"); |
||||
Assert.AreEqual("ns", name.Namespace); |
||||
} |
||||
|
||||
[Test] |
||||
public void PrefixPropertyReturnsCorrectNamespace() |
||||
{ |
||||
QualifiedName name = new QualifiedName("a", "ns", "prefix"); |
||||
Assert.AreEqual("prefix", name.Prefix); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasPrefixReturnsTrueForNonEmptyPrefix() |
||||
{ |
||||
QualifiedName name = new QualifiedName("a", "ns", "prefix"); |
||||
Assert.IsTrue(name.HasPrefix); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasPrefixReturnsFalseForEmptyPrefix() |
||||
{ |
||||
QualifiedName name = new QualifiedName("a", "ns", String.Empty); |
||||
Assert.IsFalse(name.HasPrefix); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedNameChanged() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "ns", "a"); |
||||
name.Name = "element"; |
||||
Assert.AreEqual("a:element [ns]", name.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedNameNamespaceChanged() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "ns", "a"); |
||||
name.Namespace = "new-ns"; |
||||
Assert.AreEqual("a:root [new-ns]", name.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedNamePrefixChanged() |
||||
{ |
||||
QualifiedName name = new QualifiedName("root", "ns", "a"); |
||||
name.Prefix = "newprefix"; |
||||
Assert.AreEqual("newprefix:root [ns]", name.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateQualifiedNameFromString() |
||||
{ |
||||
QualifiedName name = QualifiedName.FromString("root"); |
||||
QualifiedName expectedQualifiedName = new QualifiedName("root", String.Empty); |
||||
|
||||
Assert.AreEqual(expectedQualifiedName, name); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateQualifiedNameFromStringContainingPrefix() |
||||
{ |
||||
QualifiedName name = QualifiedName.FromString("a:root"); |
||||
QualifiedName expectedQualifiedName = new QualifiedName("root", String.Empty, "a"); |
||||
Assert.AreEqual(expectedQualifiedName, name); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateQualifiedNameFromNullString() |
||||
{ |
||||
QualifiedName name = QualifiedName.FromString(null); |
||||
Assert.IsTrue(name.IsEmpty); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue