UniqueIdTest.cs 818 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Xml;
  3. using NUnit.Framework;
  4. namespace MonoTests.System.ServiceModel
  5. {
  6. [TestFixture]
  7. public class UniqueIdTest
  8. {
  9. [Test]
  10. public void TestDefault ()
  11. {
  12. UniqueId id = new UniqueId ();
  13. Assert.IsTrue (id.IsGuid, "#1");
  14. Guid g = Guid.NewGuid ();
  15. UniqueId a = new UniqueId (g);
  16. UniqueId b = new UniqueId (g.ToByteArray ());
  17. Assert.AreEqual (a, b, "#2");
  18. Assert.AreEqual ("urn:uuid:", a.ToString ().Substring (0, 9), "#3");
  19. a = new UniqueId ("foo");
  20. Assert.AreEqual ("foo", a.ToString (), "#4");
  21. }
  22. [Test]
  23. [ExpectedException (typeof (FormatException))]
  24. public void ZeroLengthCtor ()
  25. {
  26. new UniqueId ("");
  27. }
  28. [Test]
  29. [ExpectedException (typeof (ArgumentNullException))]
  30. public void CtorNull1 ()
  31. {
  32. new UniqueId ((string) null);
  33. }
  34. }
  35. }