Skip to content

Commit f223b45

Browse files
committed
tests & api
1 parent 05fdcc3 commit f223b45

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#nullable enable
22
Microsoft.AspNetCore.DataProtection.ISpanDataProtector
3-
Microsoft.AspNetCore.DataProtection.ISpanDataProtector.GetProtectedSize(System.ReadOnlySpan<byte> plainText, out int cipherTextLength) -> int
3+
Microsoft.AspNetCore.DataProtection.ISpanDataProtector.GetProtectedSize(System.ReadOnlySpan<byte> plainText) -> int
44
Microsoft.AspNetCore.DataProtection.ISpanDataProtector.TryProtect(System.ReadOnlySpan<byte> plainText, System.Span<byte> destination, out int bytesWritten) -> bool

src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/KeyManagement/KeyRingBasedDataProtectorTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,15 @@ public void GetProtectedSize_TryProtect_CorrectlyEstimatesDataLength_MultipleSce
650650
var mockKeyRingProvider = new Mock<IKeyRingProvider>();
651651
mockKeyRingProvider.Setup(o => o.GetCurrentKeyRing()).Returns(keyRing);
652652

653-
var protector = new KeyRingBasedDataProtector(
653+
var protector = new KeyRingBasedSpanDataProtector(
654654
keyRingProvider: mockKeyRingProvider.Object,
655655
logger: GetLogger(),
656656
originalPurposes: null,
657657
newPurpose: "purpose");
658658

659659
// Act - get estimated size
660-
var protectionSizeResult = protector.TryGetProtectedSize(plaintext, out var estimatedSize);
661-
Assert.True(protectionSizeResult, "TryGetProtectedSize should succeed");
660+
var estimatedSize = protector.GetProtectedSize(plaintext);
661+
Assert.True(estimatedSize != 0);
662662

663663
// verify simple protect works
664664
var protectedData = protector.Protect(plaintext);
@@ -711,15 +711,15 @@ public void GetProtectedSize_TryProtect_VariousPlaintextSizes(int plaintextSize)
711711
var mockKeyRingProvider = new Mock<IKeyRingProvider>();
712712
mockKeyRingProvider.Setup(o => o.GetCurrentKeyRing()).Returns(keyRing);
713713

714-
var protector = new KeyRingBasedDataProtector(
714+
var protector = new KeyRingBasedSpanDataProtector(
715715
keyRingProvider: mockKeyRingProvider.Object,
716716
logger: GetLogger(),
717717
originalPurposes: null,
718718
newPurpose: "purpose");
719719

720720
// Act - get estimated size
721-
var protectionSizeResult = protector.TryGetProtectedSize(plaintext, out var estimatedSize);
722-
Assert.True(protectionSizeResult, "TryGetProtectedSize should succeed");
721+
var estimatedSize = protector.GetProtectedSize(plaintext);
722+
Assert.True(estimatedSize != 0);
723723

724724
// Act - allocate buffer and try protect
725725
byte[] destination = new byte[estimatedSize];

0 commit comments

Comments
 (0)