mirror of https://github.com/quasar/Quasar.git
commit
74cbf47a80
|
@ -39,6 +39,7 @@
|
|||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
|
@ -53,8 +54,10 @@
|
|||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="Core\Compression\JpgCompressionTests.cs" />
|
||||
<Compile Include="Core\Encryption\AES.Tests.cs" />
|
||||
<Compile Include="Core\Encryption\SHA256.Tests.cs" />
|
||||
<Compile Include="Core\Information\GeoIPTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Compression;
|
||||
|
||||
namespace xClient.Tests.Core.Compression
|
||||
{
|
||||
[TestClass]
|
||||
public class JpgCompressionTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void CompressionTest()
|
||||
{
|
||||
var quality = Int64.MaxValue;
|
||||
var jpg = new JpgCompression(quality);
|
||||
var bitmap = new Bitmap(200, 200);
|
||||
|
||||
var result = jpg.Compress(bitmap);
|
||||
|
||||
Assert.IsNotNull(result);
|
||||
CollectionAssert.AllItemsAreNotNull(result);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Encryption;
|
||||
using xClient.Core.Helper;
|
||||
|
||||
|
@ -8,7 +10,7 @@ namespace xClient.Tests.Core.Encryption
|
|||
public class AESTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void EncryptAndDecryptTest()
|
||||
public void EncryptAndDecryptStringTest()
|
||||
{
|
||||
var input = Helper.GetRandomName(100);
|
||||
var password = Helper.GetRandomName(50);
|
||||
|
@ -21,5 +23,26 @@ namespace xClient.Tests.Core.Encryption
|
|||
|
||||
Assert.IsTrue(input == decrypted);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EncryptAndDecryptByteArrayTest()
|
||||
{
|
||||
var input = Helper.GetRandomName(100);
|
||||
var inputByte = Encoding.UTF8.GetBytes(input);
|
||||
|
||||
var password = Helper.GetRandomName(50);
|
||||
var passwordByte = Encoding.UTF8.GetBytes(password);
|
||||
var encrypted = AES.Encrypt(inputByte, passwordByte);
|
||||
|
||||
Assert.IsNotNull(encrypted);
|
||||
Assert.AreNotEqual(encrypted, input);
|
||||
|
||||
var decrypted = AES.Decrypt(encrypted, passwordByte);
|
||||
|
||||
//The decryption method is adding on blank bytes.
|
||||
var realDecrypted = decrypted.Take(100).ToArray();
|
||||
|
||||
CollectionAssert.AreEqual(inputByte,realDecrypted);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using xClient.Core.Information;
|
||||
|
||||
|
||||
namespace xClient.Tests.Core.Information
|
||||
{
|
||||
[TestClass]
|
||||
public class GeoIPTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetGeoIPTest()
|
||||
{
|
||||
var ipInformation = new GeoIP();
|
||||
Assert.IsNotNull(ipInformation.City);
|
||||
Assert.IsNotNull(ipInformation.Country);
|
||||
Assert.IsNotNull(ipInformation.CountryCode);
|
||||
Assert.IsNotNull(ipInformation.Region);
|
||||
Assert.IsNotNull(ipInformation.WanIp);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
|
@ -12,6 +13,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: InternalsVisibleTo("Client.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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using xServer.Settings;
|
||||
|
||||
|
@ -13,6 +14,7 @@ using xServer.Settings;
|
|||
[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