Skip to content
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
<VerifyXunitVersion>19.14.0</VerifyXunitVersion>
<XunitAbstractionsVersion>2.0.3</XunitAbstractionsVersion>
<XunitAnalyzersVersion>1.15.0</XunitAnalyzersVersion>
<XunitVersion>2.9.0</XunitVersion>
<XunitVersion>2.9.2</XunitVersion>
<XunitAssertVersion>$(XunitVersion)</XunitAssertVersion>
<XunitExtensibilityCoreVersion>$(XunitVersion)</XunitExtensibilityCoreVersion>
<XunitExtensibilityExecutionVersion>$(XunitVersion)</XunitExtensibilityExecutionVersion>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"sdk": {
"version": "10.0.100-alpha.1.24510.13"
"version": "10.0.100-alpha.1.24553.6"
},
"tools": {
"dotnet": "10.0.100-alpha.1.24510.13",
"dotnet": "10.0.100-alpha.1.24553.6",
"runtimes": {
"dotnet/x86": [
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Encrypt_Decrypt_RoundTrips()
byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad);

// Assert
Assert.Equal(plaintext, decipheredtext);
Assert.Equal(plaintext.AsSpan(), decipheredtext.AsSpan());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienros - why is this change necessary now? Both expected and actual are byte[]. Why do they need to be cast to span?

}

[ConditionalFact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void Encrypt_Decrypt_RoundTrips()
byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad);

// Assert
Assert.Equal(plaintext, decipheredtext);
Assert.Equal(plaintext.AsSpan(), decipheredtext.AsSpan());
}

[ConditionalFact]
Expand Down Expand Up @@ -100,6 +100,6 @@ public void Encrypt_KnownKey()
// | 00 00 00 00 (postBuffer)

string retValAsString = Convert.ToBase64String(retVal);
Assert.Equal("AAAAAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaG0O2kY0NZtmh2UQtXY5B2jlgnOgAAAAA", retValAsString);
Assert.Equal("AAAAAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaG0O2kY0NZtmh2UQtXY5B2jlgnOgAAAAA".AsSpan(), retValAsString);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public void Protect_EncryptsToDefaultProtector_MultiplePurposes()
.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) =>
{
Assert.Equal(expectedPlaintext, actualPlaintext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedPlaintext.AsSpan(), actualPlaintext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
});

Expand Down Expand Up @@ -83,8 +83,8 @@ public void Protect_EncryptsToDefaultProtector_SinglePurpose()
.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) =>
{
Assert.Equal(expectedPlaintext, actualPlaintext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedPlaintext.AsSpan(), actualPlaintext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
});

Expand Down Expand Up @@ -423,8 +423,8 @@ public void Unprotect_KeyRevoked_RevocationAllowed_ReturnsOriginalData_SetsRevok
.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) =>
{
Assert.Equal(expectedCiphertext, actualCiphertext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedCiphertext.AsSpan(), actualCiphertext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return expectedPlaintext;
});
var mockDescriptor = new Mock<IAuthenticatedEncryptorDescriptor>();
Expand Down Expand Up @@ -470,8 +470,8 @@ public void Unprotect_IsAlsoDefaultKey_Success_NoMigrationRequired()
.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) =>
{
Assert.Equal(expectedCiphertext, actualCiphertext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedCiphertext.AsSpan(), actualCiphertext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return expectedPlaintext;
});
var mockDescriptor = new Mock<IAuthenticatedEncryptorDescriptor>();
Expand Down Expand Up @@ -519,8 +519,8 @@ public void Unprotect_IsNotDefaultKey_Success_RequiresMigration()
.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) =>
{
Assert.Equal(expectedCiphertext, actualCiphertext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedCiphertext.AsSpan(), actualCiphertext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return expectedPlaintext;
});
var mockDescriptor = new Mock<IAuthenticatedEncryptorDescriptor>();
Expand Down Expand Up @@ -594,8 +594,8 @@ public void CreateProtector_ChainsPurposes()
.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>()))
.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) =>
{
Assert.Equal(expectedPlaintext, actualPlaintext);
Assert.Equal(expectedAad, actualAad);
Assert.Equal(expectedPlaintext.AsSpan(), actualPlaintext);
Assert.Equal(expectedAad.AsSpan(), actualAad);
return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Encrypt_Decrypt_RoundTrips()
byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad);

// Assert
Assert.Equal(plaintext, decipheredtext);
Assert.Equal(plaintext.AsSpan(), decipheredtext.AsSpan());
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Headers/test/CacheControlHeaderValueTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public void Properties_SetAndGetAllProperties_SetValueReturnedInGetter()
Assert.Throws<FormatException>(() => cacheControl.NoCacheHeaders.Add("invalid PLACEHOLDER"));
cacheControl.NoCacheHeaders.Add("PLACEHOLDER");
Assert.Single(cacheControl.NoCacheHeaders);
Assert.Equal("PLACEHOLDER", cacheControl.NoCacheHeaders.First());
Assert.Equal("PLACEHOLDER".AsSpan(), cacheControl.NoCacheHeaders.First());

Assert.NotNull(cacheControl.PrivateHeaders);
Assert.Throws<ArgumentException>(() => cacheControl.PrivateHeaders.Add(null));
Assert.Throws<FormatException>(() => cacheControl.PrivateHeaders.Add("invalid PLACEHOLDER"));
cacheControl.PrivateHeaders.Add("PLACEHOLDER");
Assert.Single(cacheControl.PrivateHeaders);
Assert.Equal("PLACEHOLDER", cacheControl.PrivateHeaders.First());
Assert.Equal("PLACEHOLDER".AsSpan(), cacheControl.PrivateHeaders.First());

// NameValueHeaderValue collection property
Assert.NotNull(cacheControl.Extensions);
Expand Down
Loading
Loading