From 837513cfcbb5d2eab841c1ea873e8726163f1f24 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Sun, 9 Jul 2017 11:15:02 +0200 Subject: [PATCH] Basic tests --- UrlCompressor.Tests/Program.cs | 36 ++++++++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++++++ .../UrlCompressor.Tests.csproj | 55 +++++++++++++++++++ VAR.UrlCompressor.sln | 6 ++ VAR.UrlCompressor/Class1.cs | 12 ---- VAR.UrlCompressor/UrlCompressor.cs | 23 ++++++++ VAR.UrlCompressor/VAR.UrlCompressor.csproj | 30 ++++------ 7 files changed, 168 insertions(+), 30 deletions(-) create mode 100644 UrlCompressor.Tests/Program.cs create mode 100644 UrlCompressor.Tests/Properties/AssemblyInfo.cs create mode 100644 UrlCompressor.Tests/UrlCompressor.Tests.csproj delete mode 100644 VAR.UrlCompressor/Class1.cs create mode 100644 VAR.UrlCompressor/UrlCompressor.cs diff --git a/UrlCompressor.Tests/Program.cs b/UrlCompressor.Tests/Program.cs new file mode 100644 index 0000000..e94949d --- /dev/null +++ b/UrlCompressor.Tests/Program.cs @@ -0,0 +1,36 @@ +using System; + +namespace UrlCompressor.Tests +{ + class Program + { + static void Main(string[] args) + { + TestUrl("http://google.com"); + TestUrl("https://google.com"); + TestUrl("http://facebook.com"); + TestUrl("https://facebook.com"); + TestUrl("https://twitter.com"); + TestUrl("https://twitter.com/Kableado"); + TestUrl("https://github.com/Kableado"); + + Console.Read(); + } + + private static bool TestUrl(string url) + { + Console.WriteLine("---------------------------------------------"); + Console.WriteLine(" Url: {0}", url); + string compressedUrl = VAR.UrlCompressor.UrlCompressor.Compress(url); + Console.WriteLine(" CompressedUrl: {0}", compressedUrl); + string decompressedUrl = VAR.UrlCompressor.UrlCompressor.Decompress(compressedUrl); + Console.WriteLine("DecompressedUrl: {0}", decompressedUrl); + if(url!= decompressedUrl) + { + Console.WriteLine("!!!!! Failed !!!!!"); + return false; + } + return true; + } + } +} diff --git a/UrlCompressor.Tests/Properties/AssemblyInfo.cs b/UrlCompressor.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4943c80 --- /dev/null +++ b/UrlCompressor.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("UrlCompressor.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UrlCompressor.Tests")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("29d6812a-566d-4a92-a7a4-fc6ae0b3db39")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o utilizar los números de compilación y de revisión predeterminados +// mediante el carácter '*', como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UrlCompressor.Tests/UrlCompressor.Tests.csproj b/UrlCompressor.Tests/UrlCompressor.Tests.csproj new file mode 100644 index 0000000..460b24b --- /dev/null +++ b/UrlCompressor.Tests/UrlCompressor.Tests.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {29D6812A-566D-4A92-A7A4-FC6AE0B3DB39} + Exe + UrlCompressor.Tests + UrlCompressor.Tests + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {016ae05d-12af-40c6-8d0c-064970004f0b} + VAR.UrlCompressor + + + + \ No newline at end of file diff --git a/VAR.UrlCompressor.sln b/VAR.UrlCompressor.sln index a11e0df..65c7b0c 100644 --- a/VAR.UrlCompressor.sln +++ b/VAR.UrlCompressor.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26430.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.UrlCompressor", "VAR.UrlCompressor\VAR.UrlCompressor.csproj", "{016AE05D-12AF-40C6-8D0C-064970004F0B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrlCompressor.Tests", "UrlCompressor.Tests\UrlCompressor.Tests.csproj", "{29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {016AE05D-12AF-40C6-8D0C-064970004F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU {016AE05D-12AF-40C6-8D0C-064970004F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU {016AE05D-12AF-40C6-8D0C-064970004F0B}.Release|Any CPU.Build.0 = Release|Any CPU + {29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VAR.UrlCompressor/Class1.cs b/VAR.UrlCompressor/Class1.cs deleted file mode 100644 index 6eebf16..0000000 --- a/VAR.UrlCompressor/Class1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VAR.UrlCompressor -{ - public class Class1 - { - } -} diff --git a/VAR.UrlCompressor/UrlCompressor.cs b/VAR.UrlCompressor/UrlCompressor.cs new file mode 100644 index 0000000..dedfac8 --- /dev/null +++ b/VAR.UrlCompressor/UrlCompressor.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VAR.UrlCompressor +{ + public class UrlCompressor + { + public static string Compress(string url) + { + // FIXME: Implement this + return string.Empty; + } + + public static string Decompress(string compressedUrl) + { + // FIXME: Implement this + return string.Empty; + } + } +} diff --git a/VAR.UrlCompressor/VAR.UrlCompressor.csproj b/VAR.UrlCompressor/VAR.UrlCompressor.csproj index 87548c2..517cc1e 100644 --- a/VAR.UrlCompressor/VAR.UrlCompressor.csproj +++ b/VAR.UrlCompressor/VAR.UrlCompressor.csproj @@ -1,10 +1,10 @@ - + Debug AnyCPU - 016ae05d-12af-40c6-8d0c-064970004f0b + {016AE05D-12AF-40C6-8D0C-064970004F0B} Library Properties VAR.UrlCompressor @@ -30,24 +30,18 @@ 4 - - - - - - - - - - - - - - + + + + + + + + - + - + \ No newline at end of file