From cfd7472edfb7cee5e4509c11c9e18a27fc796c8f Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Wed, 26 Jun 2013 17:05:51 +0200 Subject: [PATCH] - split tests into separate project - changed to class library project --- App.config | 6 -- .../HtmlSanitizer.Tests.csproj | 91 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 35 +++++++ Tests.cs => HtmlSanitizer.Tests/Tests.cs | 0 HtmlSanitizer.Tests/packages.config | 4 + HtmlSanitizer.sln | 8 +- .../HtmlSanitizer.cs | 0 .../HtmlSanitizer.csproj | 11 +-- .../Properties}/AssemblyInfo.cs | 7 +- .../packages.config | 1 - .../CsQuery.1.3.4/CsQuery.1.3.4.nupkg | Bin .../CsQuery.1.3.4/CsQuery.1.3.4.nuspec | 0 .../CsQuery.1.3.4/lib/net40/CsQuery.XML | 0 .../CsQuery.1.3.4/lib/net40/CsQuery.dll | Bin .../packages}/NUnit.2.6.2/NUnit.2.6.2.nupkg | Bin .../packages}/NUnit.2.6.2/NUnit.2.6.2.nuspec | 0 .../NUnit.2.6.2/lib/nunit.framework.dll | Bin .../NUnit.2.6.2/lib/nunit.framework.xml | 0 .../packages}/NUnit.2.6.2/license.txt | 0 .../packages}/repositories.config | 1 + Program.cs | 17 ---- 21 files changed, 145 insertions(+), 36 deletions(-) delete mode 100644 App.config create mode 100644 HtmlSanitizer.Tests/HtmlSanitizer.Tests.csproj create mode 100644 HtmlSanitizer.Tests/Properties/AssemblyInfo.cs rename Tests.cs => HtmlSanitizer.Tests/Tests.cs (100%) create mode 100644 HtmlSanitizer.Tests/packages.config rename HtmlSanitizer.cs => HtmlSanitizer/HtmlSanitizer.cs (100%) rename HtmlSanitizer.csproj => HtmlSanitizer/HtmlSanitizer.csproj (88%) rename {Properties => HtmlSanitizer/Properties}/AssemblyInfo.cs (88%) rename packages.config => HtmlSanitizer/packages.config (66%) rename {packages => HtmlSanitizer/packages}/CsQuery.1.3.4/CsQuery.1.3.4.nupkg (100%) rename {packages => HtmlSanitizer/packages}/CsQuery.1.3.4/CsQuery.1.3.4.nuspec (100%) rename {packages => HtmlSanitizer/packages}/CsQuery.1.3.4/lib/net40/CsQuery.XML (100%) rename {packages => HtmlSanitizer/packages}/CsQuery.1.3.4/lib/net40/CsQuery.dll (100%) rename {packages => HtmlSanitizer/packages}/NUnit.2.6.2/NUnit.2.6.2.nupkg (100%) rename {packages => HtmlSanitizer/packages}/NUnit.2.6.2/NUnit.2.6.2.nuspec (100%) rename {packages => HtmlSanitizer/packages}/NUnit.2.6.2/lib/nunit.framework.dll (100%) rename {packages => HtmlSanitizer/packages}/NUnit.2.6.2/lib/nunit.framework.xml (100%) rename {packages => HtmlSanitizer/packages}/NUnit.2.6.2/license.txt (100%) rename {packages => HtmlSanitizer/packages}/repositories.config (63%) delete mode 100644 Program.cs diff --git a/App.config b/App.config deleted file mode 100644 index 1f6eeef..0000000 --- a/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/HtmlSanitizer.Tests/HtmlSanitizer.Tests.csproj b/HtmlSanitizer.Tests/HtmlSanitizer.Tests.csproj new file mode 100644 index 0000000..bad7001 --- /dev/null +++ b/HtmlSanitizer.Tests/HtmlSanitizer.Tests.csproj @@ -0,0 +1,91 @@ + + + + Debug + AnyCPU + {55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0} + Library + Properties + HtmlSanitizer.Tests + HtmlSanitizer.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 + + + + ..\HtmlSanitizer\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + + {ccdb0c26-d683-4943-b5d8-ac07116461e5} + HtmlSanitizer + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/HtmlSanitizer.Tests/Properties/AssemblyInfo.cs b/HtmlSanitizer.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bdddbdc --- /dev/null +++ b/HtmlSanitizer.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("HtmlSanitizer.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Michael Ganss")] +[assembly: AssemblyProduct("HtmlSanitizer.Tests")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5e270543-c4f6-459b-91f9-81bdcff0a037")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] diff --git a/Tests.cs b/HtmlSanitizer.Tests/Tests.cs similarity index 100% rename from Tests.cs rename to HtmlSanitizer.Tests/Tests.cs diff --git a/HtmlSanitizer.Tests/packages.config b/HtmlSanitizer.Tests/packages.config new file mode 100644 index 0000000..62adf5a --- /dev/null +++ b/HtmlSanitizer.Tests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/HtmlSanitizer.sln b/HtmlSanitizer.sln index 7b69766..58d9da2 100644 --- a/HtmlSanitizer.sln +++ b/HtmlSanitizer.sln @@ -1,7 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlSanitizer", "HtmlSanitizer.csproj", "{CCDB0C26-D683-4943-B5D8-AC07116461E5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlSanitizer", "HtmlSanitizer\HtmlSanitizer.csproj", "{CCDB0C26-D683-4943-B5D8-AC07116461E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlSanitizer.Tests", "HtmlSanitizer.Tests\HtmlSanitizer.Tests.csproj", "{55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,6 +15,10 @@ Global {CCDB0C26-D683-4943-B5D8-AC07116461E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCDB0C26-D683-4943-B5D8-AC07116461E5}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCDB0C26-D683-4943-B5D8-AC07116461E5}.Release|Any CPU.Build.0 = Release|Any CPU + {55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55D772A0-8D8C-4CF7-A876-E6DAB8ED42C0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HtmlSanitizer.cs b/HtmlSanitizer/HtmlSanitizer.cs similarity index 100% rename from HtmlSanitizer.cs rename to HtmlSanitizer/HtmlSanitizer.cs diff --git a/HtmlSanitizer.csproj b/HtmlSanitizer/HtmlSanitizer.csproj similarity index 88% rename from HtmlSanitizer.csproj rename to HtmlSanitizer/HtmlSanitizer.csproj index 7ecd044..a98335e 100644 --- a/HtmlSanitizer.csproj +++ b/HtmlSanitizer/HtmlSanitizer.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {CCDB0C26-D683-4943-B5D8-AC07116461E5} - Exe + Library Properties Html HtmlSanitizer @@ -34,13 +34,13 @@ prompt 4 + + + packages\CsQuery.1.3.4\lib\net40\CsQuery.dll - - packages\NUnit.2.6.2\lib\nunit.framework.dll - @@ -51,12 +51,9 @@ - - - diff --git a/Properties/AssemblyInfo.cs b/HtmlSanitizer/Properties/AssemblyInfo.cs similarity index 88% rename from Properties/AssemblyInfo.cs rename to HtmlSanitizer/Properties/AssemblyInfo.cs index ca9b004..335c157 100644 --- a/Properties/AssemblyInfo.cs +++ b/HtmlSanitizer/Properties/AssemblyInfo.cs @@ -6,9 +6,9 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HtmlSanitizer")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Cleans HTML from constructs that can be used for XSS")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Michael Ganss")] [assembly: AssemblyProduct("HtmlSanitizer")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] @@ -32,5 +32,4 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] diff --git a/packages.config b/HtmlSanitizer/packages.config similarity index 66% rename from packages.config rename to HtmlSanitizer/packages.config index de14061..57410fd 100644 --- a/packages.config +++ b/HtmlSanitizer/packages.config @@ -1,5 +1,4 @@  - \ No newline at end of file diff --git a/packages/CsQuery.1.3.4/CsQuery.1.3.4.nupkg b/HtmlSanitizer/packages/CsQuery.1.3.4/CsQuery.1.3.4.nupkg similarity index 100% rename from packages/CsQuery.1.3.4/CsQuery.1.3.4.nupkg rename to HtmlSanitizer/packages/CsQuery.1.3.4/CsQuery.1.3.4.nupkg diff --git a/packages/CsQuery.1.3.4/CsQuery.1.3.4.nuspec b/HtmlSanitizer/packages/CsQuery.1.3.4/CsQuery.1.3.4.nuspec similarity index 100% rename from packages/CsQuery.1.3.4/CsQuery.1.3.4.nuspec rename to HtmlSanitizer/packages/CsQuery.1.3.4/CsQuery.1.3.4.nuspec diff --git a/packages/CsQuery.1.3.4/lib/net40/CsQuery.XML b/HtmlSanitizer/packages/CsQuery.1.3.4/lib/net40/CsQuery.XML similarity index 100% rename from packages/CsQuery.1.3.4/lib/net40/CsQuery.XML rename to HtmlSanitizer/packages/CsQuery.1.3.4/lib/net40/CsQuery.XML diff --git a/packages/CsQuery.1.3.4/lib/net40/CsQuery.dll b/HtmlSanitizer/packages/CsQuery.1.3.4/lib/net40/CsQuery.dll similarity index 100% rename from packages/CsQuery.1.3.4/lib/net40/CsQuery.dll rename to HtmlSanitizer/packages/CsQuery.1.3.4/lib/net40/CsQuery.dll diff --git a/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg b/HtmlSanitizer/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg similarity index 100% rename from packages/NUnit.2.6.2/NUnit.2.6.2.nupkg rename to HtmlSanitizer/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg diff --git a/packages/NUnit.2.6.2/NUnit.2.6.2.nuspec b/HtmlSanitizer/packages/NUnit.2.6.2/NUnit.2.6.2.nuspec similarity index 100% rename from packages/NUnit.2.6.2/NUnit.2.6.2.nuspec rename to HtmlSanitizer/packages/NUnit.2.6.2/NUnit.2.6.2.nuspec diff --git a/packages/NUnit.2.6.2/lib/nunit.framework.dll b/HtmlSanitizer/packages/NUnit.2.6.2/lib/nunit.framework.dll similarity index 100% rename from packages/NUnit.2.6.2/lib/nunit.framework.dll rename to HtmlSanitizer/packages/NUnit.2.6.2/lib/nunit.framework.dll diff --git a/packages/NUnit.2.6.2/lib/nunit.framework.xml b/HtmlSanitizer/packages/NUnit.2.6.2/lib/nunit.framework.xml similarity index 100% rename from packages/NUnit.2.6.2/lib/nunit.framework.xml rename to HtmlSanitizer/packages/NUnit.2.6.2/lib/nunit.framework.xml diff --git a/packages/NUnit.2.6.2/license.txt b/HtmlSanitizer/packages/NUnit.2.6.2/license.txt similarity index 100% rename from packages/NUnit.2.6.2/license.txt rename to HtmlSanitizer/packages/NUnit.2.6.2/license.txt diff --git a/packages/repositories.config b/HtmlSanitizer/packages/repositories.config similarity index 63% rename from packages/repositories.config rename to HtmlSanitizer/packages/repositories.config index 0dec135..50c76cf 100644 --- a/packages/repositories.config +++ b/HtmlSanitizer/packages/repositories.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 3c03ac4..0000000 --- a/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Linq; -using System.Text; - -namespace Html -{ - class Program - { - static void Main(string[] args) - { - var html = Console.In.ReadToEnd(); - var sanitized = new HtmlSanitizer().Sanitize(html, args.Any() ? args[0] : ""); - Console.OutputEncoding = Encoding.UTF8; - Console.Out.Write(sanitized); - } - } -}