public void TestException() { Assert.Throws<ArgumentNullException>(() => new ObjectIdentifier((uint[])null)); Assert.Throws<ArgumentException>(() => new ObjectIdentifier(new uint[] {1})); Assert.Throws<ArgumentException>(() => new ObjectIdentifier(new uint[] {5, 8})); Assert.Throws<ArgumentException>(() => new ObjectIdentifier(new uint[] {1, 80})); Assert.Throws<ArgumentNullException>(() => new ObjectIdentifier(new Tuple<int, byte[]>(0, new byte[] { 0 }), null)); Assert.Throws<ArgumentException>(() => new ObjectIdentifier(new Tuple<int, byte[]>(0, new byte[] { 0 }), new MemoryStream())); // ReSharper disable RedundantCast Assert.Throws<ArgumentNullException>(() => new ObjectIdentifier(new uint[] {1, 3}).CompareTo((ObjectIdentifier)null)); // ReSharper restore RedundantCast Assert.Throws<ArgumentNullException>(() => ObjectIdentifier.Convert((uint[])null)); Assert.Throws<ArgumentNullException>(() => ObjectIdentifier.Convert((string)null)); var oid = new ObjectIdentifier(new uint[] { 1, 3 }); Assert.Throws<ArgumentException>(() => oid.CompareTo(80)); Assert.Throws<ArgumentNullException>(() => ObjectIdentifier.Create(null, 0)); Assert.Throws<ArgumentNullException>(() => oid.AppendBytesTo(null)); }
public void TestException() { Assert.Throws <ArgumentNullException>(() => new ObjectIdentifier((uint[])null)); Assert.Throws <ArgumentException>(() => new ObjectIdentifier(new uint[] { 1 })); Assert.Throws <ArgumentException>(() => new ObjectIdentifier(new uint[] { 5, 8 })); Assert.Throws <ArgumentException>(() => new ObjectIdentifier(new uint[] { 1, 80 })); Assert.Throws <ArgumentNullException>(() => new ObjectIdentifier(new Tuple <int, byte[]>(0, new byte[] { 0 }), null)); Assert.Throws <ArgumentException>(() => new ObjectIdentifier(new Tuple <int, byte[]>(0, new byte[] { 0 }), new MemoryStream())); // ReSharper disable RedundantCast Assert.Throws <ArgumentNullException>(() => new ObjectIdentifier(new uint[] { 1, 3 }).CompareTo((ObjectIdentifier)null)); // ReSharper restore RedundantCast Assert.Throws <ArgumentNullException>(() => ObjectIdentifier.Convert((uint[])null)); Assert.Throws <ArgumentNullException>(() => ObjectIdentifier.Convert((string)null)); var oid = new ObjectIdentifier(new uint[] { 1, 3 }); Assert.Throws <ArgumentException>(() => oid.CompareTo(80)); Assert.Throws <ArgumentNullException>(() => ObjectIdentifier.Create(null, 0)); Assert.Throws <ArgumentNullException>(() => oid.AppendBytesTo(null)); }