From 51df512eea6f95b16b33b4ef7e460be56deee2f9 Mon Sep 17 00:00:00 2001 From: andreym Date: Thu, 26 Sep 2013 18:36:14 +0200 Subject: [PATCH 1/2] Revert "Initial commit" This reverts commit 8d252e608273437d0df69b97c005da74190cfeea. --- .gitignore | 108 ----------------------------------------------------- LICENSE | 20 ---------- README.md | 4 -- 3 files changed, 132 deletions(-) delete mode 100644 .gitignore delete mode 100644 LICENSE delete mode 100644 README.md diff --git a/.gitignore b/.gitignore deleted file mode 100644 index bdc3535..0000000 --- a/.gitignore +++ /dev/null @@ -1,108 +0,0 @@ -# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) -[Bb]in/ -[Oo]bj/ - -# mstest test results -TestResults - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -x64/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.log -*.vspscc -*.vssscc -.builds - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper* - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Publish Web Output -*.Publish.xml - -# NuGet Packages Directory -packages - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -[Bb]in -[Oo]bj -sql -TestResults -[Tt]est[Rr]esult* -*.Cache -ClientBin -[Ss]tyle[Cc]op.* -~$* -*.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 95a87e5..0000000 --- a/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 DominicCronin - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 8c9507b..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -T-cubed -======= - -Tridion Template Testing Framework From 08899870f670c3283ae7b0a6ab3ea0e00a39d5a9 Mon Sep 17 00:00:00 2001 From: quirijnslings Date: Fri, 27 Sep 2013 03:33:41 -0700 Subject: [PATCH 2/2] --- .../MockCustomerImplementation.csproj | 75 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../MockCustomerImplementation/SampleSetup.cs | 18 +++++ .../MockCustomerImplementation/SampleTest.cs | 17 +++++ TestingFramework/TestingFramework.sln | 12 +++ .../TestingFrameworkCore/BaseGeneric.cs | 36 +++++++++ .../TestingFrameworkCore/BaseSetup.cs | 30 ++++++++ .../TestingFrameworkCore/BaseTest.cs | 32 ++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../TestingFrameworkCore.csproj | 70 +++++++++++++++++ 10 files changed, 362 insertions(+) create mode 100644 TestingFramework/MockCustomerImplementation/MockCustomerImplementation.csproj create mode 100644 TestingFramework/MockCustomerImplementation/Properties/AssemblyInfo.cs create mode 100644 TestingFramework/MockCustomerImplementation/SampleSetup.cs create mode 100644 TestingFramework/MockCustomerImplementation/SampleTest.cs create mode 100644 TestingFramework/TestingFrameworkCore/BaseGeneric.cs create mode 100644 TestingFramework/TestingFrameworkCore/BaseSetup.cs create mode 100644 TestingFramework/TestingFrameworkCore/BaseTest.cs create mode 100644 TestingFramework/TestingFrameworkCore/Properties/AssemblyInfo.cs create mode 100644 TestingFramework/TestingFrameworkCore/TestingFrameworkCore.csproj diff --git a/TestingFramework/MockCustomerImplementation/MockCustomerImplementation.csproj b/TestingFramework/MockCustomerImplementation/MockCustomerImplementation.csproj new file mode 100644 index 0000000..d53ceca --- /dev/null +++ b/TestingFramework/MockCustomerImplementation/MockCustomerImplementation.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {6281540E-35D0-4A61-9F09-B749BCB2D7A9} + Library + Properties + MockCustomerImplementation + MockCustomerImplementation + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + ..\..\ReferenceAssemblies\Tridion.Common.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Common.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Publishing.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Templating.dll + + + ..\..\ReferenceAssemblies\Tridion.Logging.dll + + + + + + + + + + {b75ac99d-951e-4391-9a2f-936e6d155ccb} + TestingFrameworkCore + + + + + \ No newline at end of file diff --git a/TestingFramework/MockCustomerImplementation/Properties/AssemblyInfo.cs b/TestingFramework/MockCustomerImplementation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c996d1d --- /dev/null +++ b/TestingFramework/MockCustomerImplementation/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("MockCustomerImplementation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Hewlett-Packard")] +[assembly: AssemblyProduct("MockCustomerImplementation")] +[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 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("3168aa36-22b0-46af-a45f-e074a3dd034c")] + +// 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.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TestingFramework/MockCustomerImplementation/SampleSetup.cs b/TestingFramework/MockCustomerImplementation/SampleSetup.cs new file mode 100644 index 0000000..573e570 --- /dev/null +++ b/TestingFramework/MockCustomerImplementation/SampleSetup.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tridion.Extensions.Testing; + +namespace MockCustomerImplementation +{ + public class SampleSetup : BaseSetup + { + + public override void Setup() + { + throw new NotImplementedException(); + } + } +} diff --git a/TestingFramework/MockCustomerImplementation/SampleTest.cs b/TestingFramework/MockCustomerImplementation/SampleTest.cs new file mode 100644 index 0000000..7c8ec75 --- /dev/null +++ b/TestingFramework/MockCustomerImplementation/SampleTest.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tridion.Extensions.Testing; + +namespace MockCustomerImplementation +{ + public class SampleTest : BaseTest + { + public override void Test() + { + throw new NotImplementedException(); + } + } +} diff --git a/TestingFramework/TestingFramework.sln b/TestingFramework/TestingFramework.sln index 669dea0..3b57cce 100644 --- a/TestingFramework/TestingFramework.sln +++ b/TestingFramework/TestingFramework.sln @@ -3,6 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReplaceComponentItem", "ReplaceComponentItem\ReplaceComponentItem.csproj", "{CC2B7BE1-F783-4510-B42A-0262939D1886}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestingFrameworkCore", "TestingFrameworkCore\TestingFrameworkCore.csproj", "{B75AC99D-951E-4391-9A2F-936E6D155CCB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockCustomerImplementation", "MockCustomerImplementation\MockCustomerImplementation.csproj", "{6281540E-35D0-4A61-9F09-B749BCB2D7A9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -13,6 +17,14 @@ Global {CC2B7BE1-F783-4510-B42A-0262939D1886}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC2B7BE1-F783-4510-B42A-0262939D1886}.Release|Any CPU.ActiveCfg = Release|Any CPU {CC2B7BE1-F783-4510-B42A-0262939D1886}.Release|Any CPU.Build.0 = Release|Any CPU + {B75AC99D-951E-4391-9A2F-936E6D155CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B75AC99D-951E-4391-9A2F-936E6D155CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B75AC99D-951E-4391-9A2F-936E6D155CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B75AC99D-951E-4391-9A2F-936E6D155CCB}.Release|Any CPU.Build.0 = Release|Any CPU + {6281540E-35D0-4A61-9F09-B749BCB2D7A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6281540E-35D0-4A61-9F09-B749BCB2D7A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6281540E-35D0-4A61-9F09-B749BCB2D7A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6281540E-35D0-4A61-9F09-B749BCB2D7A9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/TestingFramework/TestingFrameworkCore/BaseGeneric.cs b/TestingFramework/TestingFrameworkCore/BaseGeneric.cs new file mode 100644 index 0000000..993df14 --- /dev/null +++ b/TestingFramework/TestingFrameworkCore/BaseGeneric.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tridion.ContentManager.Templating; +using Tridion.ContentManager.Templating.Assembly; + +namespace Tridion.Extensions.Testing +{ + public abstract class BaseGeneric : ITemplate + { + protected Engine Engine { get; set; } + protected Package Package { get; set; } + private TemplatingLogger _logger = null; + protected virtual TemplatingLogger Logger + { + get + { + if (_logger == null) + { + _logger = TemplatingLogger.GetLogger(this.GetType()); + } + return _logger; + } + } + + public void Transform(Engine engine, Package package) + { + Engine = engine; + Package = package; + Transform(); + } + public abstract void Transform(); + } +} diff --git a/TestingFramework/TestingFrameworkCore/BaseSetup.cs b/TestingFramework/TestingFrameworkCore/BaseSetup.cs new file mode 100644 index 0000000..550d040 --- /dev/null +++ b/TestingFramework/TestingFrameworkCore/BaseSetup.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tridion.ContentManager.Templating; +using Tridion.ContentManager.Templating.Assembly; + +namespace Tridion.Extensions.Testing +{ + public abstract class BaseSetup : BaseGeneric + { + + + public override void Transform() + { + Setup(); + } + + public abstract void Setup(); + + + #region Package manipulation methods + protected void SetPackageItem(string name, string value) + { + Package.GetByName(name).SetAsString(value); + } + #endregion + } +} diff --git a/TestingFramework/TestingFrameworkCore/BaseTest.cs b/TestingFramework/TestingFrameworkCore/BaseTest.cs new file mode 100644 index 0000000..3e466b0 --- /dev/null +++ b/TestingFramework/TestingFrameworkCore/BaseTest.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tridion.ContentManager.Templating; +using Tridion.ContentManager.Templating.Assembly; + +namespace Tridion.Extensions.Testing +{ + public abstract class BaseTest : BaseGeneric + { + + + public override void Transform() + { + Test(); + } + + public abstract void Test(); + + + #region Assertion methods + protected bool AssertPackageContains(string name, string value = null) + { + if (value == null) + return Package.GetByName(name) != null; + return Package.GetByName(name) != null ? Package.GetByName(name).GetAsString().Equals(value) : false; + } + #endregion + } +} diff --git a/TestingFramework/TestingFrameworkCore/Properties/AssemblyInfo.cs b/TestingFramework/TestingFrameworkCore/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2d0fd3a --- /dev/null +++ b/TestingFramework/TestingFrameworkCore/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("TestingFrameworkCore")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Hewlett-Packard")] +[assembly: AssemblyProduct("TestingFrameworkCore")] +[assembly: AssemblyCopyright("Copyright © Hewlett-Packard 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("c2e0322e-8fae-4c4c-a4a5-1e7f40a75659")] + +// 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.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TestingFramework/TestingFrameworkCore/TestingFrameworkCore.csproj b/TestingFramework/TestingFrameworkCore/TestingFrameworkCore.csproj new file mode 100644 index 0000000..27656a2 --- /dev/null +++ b/TestingFramework/TestingFrameworkCore/TestingFrameworkCore.csproj @@ -0,0 +1,70 @@ + + + + + Debug + AnyCPU + {B75AC99D-951E-4391-9A2F-936E6D155CCB} + Library + Properties + Tridion.Extensions.Testing + Tridion.Extensions.Testing + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + ..\..\ReferenceAssemblies\Tridion.Common.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Common.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Publishing.dll + + + ..\..\ReferenceAssemblies\Tridion.ContentManager.Templating.dll + + + ..\..\ReferenceAssemblies\Tridion.Logging.dll + + + + + + + + + + + \ No newline at end of file