diff --git a/Tests/Cosmos.Common.Tests/.editorconfig b/Tests/Cosmos.Common.Tests/.editorconfig
new file mode 100644
index 000000000..28b282990
--- /dev/null
+++ b/Tests/Cosmos.Common.Tests/.editorconfig
@@ -0,0 +1,9 @@
+; 4-column space indentation
+root=true
+tab_width=4
+indent_size=4
+
+[*.cs]
+tab_width=4
+indent_size=4
+indent_style=space
diff --git a/Tests/Cosmos.Common.Tests/Cosmos.Common.Tests.csproj b/Tests/Cosmos.Common.Tests/Cosmos.Common.Tests.csproj
new file mode 100644
index 000000000..25dbe308b
--- /dev/null
+++ b/Tests/Cosmos.Common.Tests/Cosmos.Common.Tests.csproj
@@ -0,0 +1,92 @@
+
+
+
+ Debug
+ AnyCPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}
+ Library
+ Properties
+ Cosmos.Common.Tests
+ Cosmos.Common.Tests
+ v4.5
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {1fac100c-d732-4ea4-b518-5af4baf64f2e}
+ Cosmos.Common
+
+
+
+
+
+
+
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tests/Cosmos.Common.Tests/Properties/AssemblyInfo.cs b/Tests/Cosmos.Common.Tests/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..047992d1e
--- /dev/null
+++ b/Tests/Cosmos.Common.Tests/Properties/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Cosmos.Common.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Cosmos")]
+[assembly: AssemblyProduct("Cosmos.Common.Tests")]
+[assembly: AssemblyCopyright("Copyright © Cosmos 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+// Если данный проект доступен для модели COM, следующий GUID используется в качестве идентификатора библиотеки типов
+[assembly: Guid("0d2dce1c-2a34-4cff-9a33-e9d9b8518d50")]
+
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tests/Cosmos.Common.Tests/ToHexStringTest.cs b/Tests/Cosmos.Common.Tests/ToHexStringTest.cs
new file mode 100644
index 000000000..026e5996a
--- /dev/null
+++ b/Tests/Cosmos.Common.Tests/ToHexStringTest.cs
@@ -0,0 +1,47 @@
+namespace Cosmos.Common.Tests
+{
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+ using Cosmos.Common.Extensions;
+
+ [TestClass]
+ public class ToHexStringTest
+ {
+ ///
+ /// Test to hex conversion method.
+ ///
+ [TestMethod]
+ public void TestToHexUnit32()
+ {
+ uint testValue = 32;
+ Assert.AreEqual("00000020", testValue.ToHex());
+ Assert.AreEqual("00000020", testValue.ToHex(8));
+ Assert.AreEqual("0000020", testValue.ToHex(7));
+ Assert.AreEqual("0020", testValue.ToHex(4));
+ Assert.AreEqual("20", testValue.ToHex(2));
+ }
+
+ ///
+ /// Test to hex conversion method.
+ ///
+ [TestMethod]
+ public void TestToHexUnit16()
+ {
+ ushort testValue = 34;
+ Assert.AreEqual("0022", testValue.ToHex());
+ Assert.AreEqual("0022", testValue.ToHex(4));
+ Assert.AreEqual("22", testValue.ToHex(2));
+ }
+
+ ///
+ /// Test to hex conversion method.
+ ///
+ [TestMethod]
+ public void TestToHexUnit8()
+ {
+ byte testValue = 34;
+ Assert.AreEqual("22", testValue.ToHex());
+ Assert.AreEqual("0022", testValue.ToHex(4));
+ Assert.AreEqual("22", testValue.ToHex(2));
+ }
+ }
+}
diff --git a/source/Cosmos.Common/Cosmos.Common.csproj b/source/Cosmos.Common/Cosmos.Common.csproj
index 326b53c1b..1e4c1926f 100644
--- a/source/Cosmos.Common/Cosmos.Common.csproj
+++ b/source/Cosmos.Common/Cosmos.Common.csproj
@@ -80,6 +80,7 @@
+
diff --git a/source/Cosmos.Common/NumberHelper.cs b/source/Cosmos.Common/NumberHelper.cs
new file mode 100644
index 000000000..810221c00
--- /dev/null
+++ b/source/Cosmos.Common/NumberHelper.cs
@@ -0,0 +1,28 @@
+namespace Cosmos.Common
+{
+ using System;
+ using Cosmos.Common.Extensions;
+
+ ///
+ /// Helper class for working with numbers.
+ ///
+ public static class NumberHelper
+ {
+ ///
+ /// Write number to console.
+ ///
+ /// A value to print.
+ /// A value indicating whether strarting zeros should be present.
+ public static void WriteNumber(uint aValue, bool aZeroFill)
+ {
+ if (aZeroFill)
+ {
+ Console.WriteLine("0x" + aValue.ToHex());
+ }
+ else
+ {
+ Console.WriteLine("0x" + aValue.ToHex().TrimStart('0'));
+ }
+ }
+ }
+}
diff --git a/source/Cosmos.sln b/source/Cosmos.sln
index 425fd458b..23c0387e3 100644
--- a/source/Cosmos.sln
+++ b/source/Cosmos.sln
@@ -215,6 +215,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElfMap2DebugDb", "ElfMap2De
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emile.TestApp", "..\Users\Emile\Emile.TestApp\Emile.TestApp.csproj", "{99A78D26-0277-4882-97BE-F5A0FA90CBCF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Common.Tests", "..\Tests\Cosmos.Common.Tests\Cosmos.Common.Tests.csproj", "{0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1060,6 +1062,22 @@ Global
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{99A78D26-0277-4882-97BE-F5A0FA90CBCF}.Release|x86.ActiveCfg = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Itanium.ActiveCfg = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Itanium.Build.0 = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Debug|x86.Build.0 = Debug|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Itanium.ActiveCfg = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Itanium.Build.0 = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|x86.ActiveCfg = Release|Any CPU
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1141,5 +1159,6 @@ Global
{ABE135D1-ACF8-4C25-A5DF-A96F013242C5} = {45E223F1-F219-4D48-96EC-85E0E0065BE7}
{BD054B3B-D183-4C19-BBD3-E853B736818A} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
{99A78D26-0277-4882-97BE-F5A0FA90CBCF} = {EE39BC20-06D5-49F7-943A-58C1C1B179D3}
+ {0D2DCE1C-2A34-4CFF-9A33-E9D9B8518D50} = {CAF5EB57-6CAD-446D-8FC7-4C03D4B996A6}
EndGlobalSection
EndGlobal