ReadResourceBytes() public static method

public static ReadResourceBytes ( string filename ) : byte[]
filename string
return byte[]
Example #1
0
 public void TestReadToEnd()
 {
     byte[] originalData = CommonUtils.ReadResourceBytes("Test.Eyes.Sdk.Core.DotNet.Resources.fa-regular-400.svg");
     using (Stream input = new MemoryStream(originalData))
     {
         byte[] output = input.ReadToEnd();
         Assert.AreEqual(input.Length, output.Length, "length");
         CollectionAssert.AreEqual(originalData, output);
     }
 }
Example #2
0
 public void TestReadToEndWithMaximumLength(int maxLength)
 {
     byte[] originalData = CommonUtils.ReadResourceBytes("Test.Eyes.Sdk.Core.DotNet.Resources.fa-regular-400.svg");
     using (Stream input = new MemoryStream(originalData))
     {
         byte[] output = input.ReadToEnd(maxLength: maxLength);
         Assert.AreEqual(maxLength, output.Length, "length");
         byte[] expectedData = new byte[maxLength];
         for (int i = 0; i < maxLength; ++i)
         {
             expectedData[i] = originalData[i];
         }
         CollectionAssert.AreEqual(expectedData, output);
     }
 }