mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 10:26:34 +00:00
put StreamToString to extensions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Azaion.Common.Extensions;
|
||||
using Azaion.Services;
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json;
|
||||
@@ -27,7 +28,7 @@ public class SecurityTest
|
||||
await encryptedStream.DecryptTo(decryptedStream, key);
|
||||
encryptedStream.Close();
|
||||
|
||||
var str = StreamToString(decryptedStream);
|
||||
var str = decryptedStream.ConvertToString();
|
||||
str.Should().Be(testString);
|
||||
}
|
||||
|
||||
@@ -91,17 +92,9 @@ public class SecurityTest
|
||||
return stream;
|
||||
}
|
||||
|
||||
private static string StreamToString(Stream stream)
|
||||
{
|
||||
stream.Position = 0;
|
||||
using var reader = new StreamReader(stream, Encoding.UTF8);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
|
||||
private static Stream StringToStream(string src)
|
||||
{
|
||||
var byteArray = Encoding.UTF8.GetBytes(src);
|
||||
return new MemoryStream(byteArray);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user