From 35077b6327967008935b86961551a093e449c209 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 14 May 2015 09:26:28 +0100 Subject: [PATCH] Made changes as requested --- .../Core/Compression/JpgCompressionTests.cs | 5 +---- Client.Tests/Core/Encryption/AES.Tests.cs | 18 +++++------------- Client.Tests/Core/Information/GeoIPTests.cs | 6 ++---- Server/Properties/AssemblyInfo.cs | 2 ++ 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Client.Tests/Core/Compression/JpgCompressionTests.cs b/Client.Tests/Core/Compression/JpgCompressionTests.cs index 59235f35..17cc8c47 100644 --- a/Client.Tests/Core/Compression/JpgCompressionTests.cs +++ b/Client.Tests/Core/Compression/JpgCompressionTests.cs @@ -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); diff --git a/Client.Tests/Core/Encryption/AES.Tests.cs b/Client.Tests/Core/Encryption/AES.Tests.cs index 0e72f3d3..99f9aadb 100644 --- a/Client.Tests/Core/Encryption/AES.Tests.cs +++ b/Client.Tests/Core/Encryption/AES.Tests.cs @@ -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; - } - } } \ No newline at end of file diff --git a/Client.Tests/Core/Information/GeoIPTests.cs b/Client.Tests/Core/Information/GeoIPTests.cs index fea49649..d210c31d 100644 --- a/Client.Tests/Core/Information/GeoIPTests.cs +++ b/Client.Tests/Core/Information/GeoIPTests.cs @@ -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); diff --git a/Server/Properties/AssemblyInfo.cs b/Server/Properties/AssemblyInfo.cs index c784f58c..3ddd267e 100644 --- a/Server/Properties/AssemblyInfo.cs +++ b/Server/Properties/AssemblyInfo.cs @@ -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