2
0

ObjectIdentifierTest.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using Renci.SshNet.Common;
  4. using Renci.SshNet.Tests.Common;
  5. namespace Renci.SshNet.Tests.Classes.Common
  6. {
  7. [TestClass]
  8. public class ObjectIdentifierTest : TestBase
  9. {
  10. [TestMethod]
  11. public void Constructor_IdentifiersIsNull()
  12. {
  13. const ulong[] identifiers = null;
  14. var actualException = Assert.ThrowsException<ArgumentNullException>(() => new ObjectIdentifier(identifiers));
  15. Assert.AreEqual(typeof(ArgumentNullException), actualException.GetType());
  16. Assert.IsNull(actualException.InnerException);
  17. Assert.AreEqual(nameof(identifiers), actualException.ParamName);
  18. }
  19. [TestMethod]
  20. public void Constructor_LengthOfIdentifiersIsLessThanTwo()
  21. {
  22. var identifiers = new[] { 5UL };
  23. var actualException = Assert.ThrowsException<ArgumentException>(() => new ObjectIdentifier(identifiers));
  24. Assert.AreEqual(typeof(ArgumentException), actualException.GetType());
  25. Assert.IsNull(actualException.InnerException);
  26. ArgumentExceptionAssert.MessageEquals("Must contain at least two elements.", actualException);
  27. Assert.AreEqual(nameof(identifiers), actualException.ParamName);
  28. }
  29. }
  30. }