mirror of https://github.com/quasar/Quasar.git
Made changes as requested
This commit is contained in:
parent
bf842c5ec2
commit
35077b6327
|
@ -1,10 +1,7 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Compression;
|
||||
using xClient.Core.Helper;
|
||||
|
||||
namespace xClient.Tests.Core.Compression
|
||||
{
|
||||
|
@ -12,7 +9,7 @@ namespace xClient.Tests.Core.Compression
|
|||
public class JpgCompressionTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void EncryptAndDecryptStringTest()
|
||||
public void CompressionTest()
|
||||
{
|
||||
var quality = Int64.MaxValue;
|
||||
var jpg = new JpgCompression(quality);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Encryption;
|
||||
using xClient.Core.Helper;
|
||||
|
@ -27,10 +28,10 @@ public void EncryptAndDecryptStringTest()
|
|||
public void EncryptAndDecryptByteArrayTest()
|
||||
{
|
||||
var input = Helper.GetRandomName(100);
|
||||
var inputByte = GetBytes(input);
|
||||
var inputByte = Encoding.UTF8.GetBytes(input);
|
||||
|
||||
var password = Helper.GetRandomName(50);
|
||||
var passwordByte = GetBytes(password);
|
||||
var passwordByte = Encoding.UTF8.GetBytes(password);
|
||||
var encrypted = AES.Encrypt(inputByte, passwordByte);
|
||||
|
||||
Assert.IsNotNull(encrypted);
|
||||
|
@ -38,19 +39,10 @@ public void EncryptAndDecryptByteArrayTest()
|
|||
|
||||
var decrypted = AES.Decrypt(encrypted, passwordByte);
|
||||
|
||||
//The decryption method is adding on 9 blank bytes.
|
||||
var realDecrypted = decrypted.Take(200).ToArray();
|
||||
//The decryption method is adding on blank bytes.
|
||||
var realDecrypted = decrypted.Take(100).ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(inputByte,realDecrypted);
|
||||
}
|
||||
|
||||
|
||||
private static byte[] GetBytes(string str)
|
||||
{
|
||||
byte[] bytes = new byte[str.Length * sizeof(char)];
|
||||
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Information;
|
||||
|
||||
|
||||
|
@ -10,7 +8,7 @@ namespace xClient.Tests.Core.Information
|
|||
public class GeoIPTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void EncryptAndDecryptStringTest()
|
||||
public void GetGeoIPTest()
|
||||
{
|
||||
var ipInformation = new GeoIP();
|
||||
Assert.IsNotNull(ipInformation.City);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using xServer.Settings;
|
||||
|
||||
|
@ -13,6 +14,7 @@
|
|||
[assembly: AssemblyCopyright("Copyright © MaxX0r 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: InternalsVisibleTo("Server.Tests")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
|
|
Loading…
Reference in New Issue