Basic tests
This commit is contained in:
36
UrlCompressor.Tests/Program.cs
Normal file
36
UrlCompressor.Tests/Program.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
UrlCompressor.Tests/Properties/AssemblyInfo.cs
Normal file
36
UrlCompressor.Tests/Properties/AssemblyInfo.cs
Normal file
@@ -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")]
|
||||||
55
UrlCompressor.Tests/UrlCompressor.Tests.csproj
Normal file
55
UrlCompressor.Tests/UrlCompressor.Tests.csproj
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>UrlCompressor.Tests</RootNamespace>
|
||||||
|
<AssemblyName>UrlCompressor.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\VAR.UrlCompressor\VAR.UrlCompressor.csproj">
|
||||||
|
<Project>{016ae05d-12af-40c6-8d0c-064970004f0b}</Project>
|
||||||
|
<Name>VAR.UrlCompressor</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26430.15
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.UrlCompressor", "VAR.UrlCompressor\VAR.UrlCompressor.csproj", "{016AE05D-12AF-40C6-8D0C-064970004F0B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.UrlCompressor", "VAR.UrlCompressor\VAR.UrlCompressor.csproj", "{016AE05D-12AF-40C6-8D0C-064970004F0B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UrlCompressor.Tests", "UrlCompressor.Tests\UrlCompressor.Tests.csproj", "{29D6812A-566D-4A92-A7A4-FC6AE0B3DB39}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{016AE05D-12AF-40C6-8D0C-064970004F0B}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -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
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
23
VAR.UrlCompressor/UrlCompressor.cs
Normal file
23
VAR.UrlCompressor/UrlCompressor.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>016ae05d-12af-40c6-8d0c-064970004f0b</ProjectGuid>
|
<ProjectGuid>{016AE05D-12AF-40C6-8D0C-064970004F0B}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>VAR.UrlCompressor</RootNamespace>
|
<RootNamespace>VAR.UrlCompressor</RootNamespace>
|
||||||
@@ -30,24 +30,18 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System"/>
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Core"/>
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Xml.Linq"/>
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Data.DataSetExtensions"/>
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="Microsoft.CSharp"/>
|
<Reference Include="System.Xml" />
|
||||||
|
|
||||||
<Reference Include="System.Data"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Net.Http"/>
|
|
||||||
|
|
||||||
<Reference Include="System.Xml"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Class1.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UrlCompressor.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user