Skip to content

Commit

Permalink
Add a test case fore params byte array.
Browse files Browse the repository at this point in the history
  • Loading branch information
LingxiaChen committed Aug 5, 2019
1 parent ec8fe82 commit 35637ad
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,30 @@ public void TestMethod(byte[] someOtherBytesForIV, byte unknownByte)
GetCSharpResultAt(17, 9, 12, 13, "ICryptoTransform SymmetricAlgorithm.CreateEncryptor(byte[] rgbKey, byte[] rgbIV)", "void TestClass.TestMethod(byte[] someOtherBytesForIV, byte unknownByte)", "byte[]", "void TestClass.TestMethod(byte[] someOtherBytesForIV, byte unknownByte)"));
}

[Fact]
public void Test_HardcodeByParamsBytesArray_CreateEncryptor_Diagnostic()
{
VerifyCSharpWithDependencies(@"
using System;
using System.Security.Cryptography;
class TestClass
{
public void TestMethod(byte[] someOtherBytesForIV)
{
byte[] rgbKey = GetArray(1, 2, 3);
SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();
rijn.CreateEncryptor(rgbKey, someOtherBytesForIV);
}
public byte[] GetArray(params byte[] array)
{
return array;
}
}",
GetCSharpResultAt(11, 9, 9, 25, "ICryptoTransform SymmetricAlgorithm.CreateEncryptor(byte[] rgbKey, byte[] rgbIV)", "void TestClass.TestMethod(byte[] someOtherBytesForIV)", "byte[]", "void TestClass.TestMethod(byte[] someOtherBytesForIV)"));
}

[Fact]
public void Test_ElementTypeIsTypeParameter_NoDiagnostic()
{
Expand Down

0 comments on commit 35637ad

Please sign in to comment.