|
3 | 3 | using Renci.SshNet.Messages.Connection;
|
4 | 4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
5 | 5 | using System;
|
| 6 | +using Renci.SshNet.Abstractions; |
6 | 7 | using Renci.SshNet.Tests.Common;
|
7 | 8 |
|
8 | 9 | namespace Renci.SshNet.Tests.Classes.Messages.Connection
|
9 | 10 | {
|
10 | 11 | /// <summary>
|
11 |
| - ///This is a test class for ChannelDataMessageTest and is intended |
12 |
| - ///to contain all ChannelDataMessageTest Unit Tests |
13 |
| - ///</summary> |
| 12 | + /// This is a test class for ChannelDataMessageTest and is intended |
| 13 | + /// to contain all ChannelDataMessageTest Unit Tests |
| 14 | + /// </summary> |
14 | 15 | [TestClass]
|
15 | 16 | public class ChannelDataMessageTest : TestBase
|
16 | 17 | {
|
@@ -98,10 +99,9 @@ public void GetBytes()
|
98 | 99 | var random = new Random();
|
99 | 100 |
|
100 | 101 | var localChannelNumber = (uint) random.Next(0, int.MaxValue);
|
101 |
| - var data = new byte[random.Next(10, 20)]; |
102 |
| - random.NextBytes(data); |
103 |
| - var offset = random.Next(2, 4); |
104 |
| - var size = random.Next(5, 9); |
| 102 | + var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20)); |
| 103 | + var offset = random.Next(0, data.Length - 1); |
| 104 | + var size = random.Next(0, data.Length - offset); |
105 | 105 |
|
106 | 106 | var target = new ChannelDataMessage(localChannelNumber, data, offset, size);
|
107 | 107 |
|
@@ -133,11 +133,10 @@ public void Load()
|
133 | 133 | var random = new Random();
|
134 | 134 |
|
135 | 135 | var localChannelNumber = (uint) random.Next(0, int.MaxValue);
|
136 |
| - var data = new byte[random.Next(10, 20)]; |
137 |
| - random.NextBytes(data); |
| 136 | + var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20)); |
138 | 137 |
|
139 |
| - var offset = random.Next(2, 4); |
140 |
| - var size = random.Next(5, 9); |
| 138 | + var offset = random.Next(0, data.Length - 1); |
| 139 | + var size = random.Next(0, data.Length - offset); |
141 | 140 | var channelDataMessage = new ChannelDataMessage(localChannelNumber, data, offset, size);
|
142 | 141 | var bytes = channelDataMessage.GetBytes();
|
143 | 142 | var target = new ChannelDataMessage();
|
|
0 commit comments