-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luuk Sommers
committed
Oct 23, 2017
1 parent
775c529
commit 3123491
Showing
9 changed files
with
337 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
ID: "2a65abb0-3123-469f-a603-5f3b1804713c" | ||
Parent: "756fff26-90f2-4889-bace-da656e66b9c1" | ||
Template: "013bc834-c0f6-4377-924e-0de185abfbe7" | ||
Path: /sitecore/content/Home/MultiLanguage | ||
DB: master | ||
Languages: | ||
- Language: de | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: "German Field1" | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: "German Field2" | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: "English Field1" | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: "English Field2" | ||
- Language: fr | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: "French Field1" | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: "French Field2" | ||
- Language: nl | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: "Dutch Field1" | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: "Dutch Field2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
ID: "2a65abb0-3123-469f-a603-5f3b1804713c" | ||
Parent: "756fff26-90f2-4889-bace-da656e66b9c1" | ||
Template: "013bc834-c0f6-4377-924e-0de185abfbe7" | ||
Path: /sitecore/content/Home/MultiLanguage | ||
DB: master | ||
Languages: | ||
- Language: de | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: TransformedField1 | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: TransformedField2 | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: TransformedField1 | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: TransformedField2 | ||
- Language: fr | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: TransformedField1 | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: TransformedField2 | ||
- Language: nl | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "00000000-0000-0000-0000-000000000000" | ||
Hint: Field1 | ||
Value: TransformedField1 | ||
- ID: "00000000-0000-0000-0000-000000000001" | ||
Hint: Field2 | ||
Value: TransformedField2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"FieldId": "00000000-0000-0000-0000-000000000000", | ||
"Hint": "Field1", | ||
"Languages": "*", | ||
"Path": "/sitecore/content/Home/MultiLanguage", | ||
"Type": "Languages", | ||
"Value": "TransformedField1" | ||
}, | ||
{ | ||
"FieldId": "00000000-0000-0000-0000-000000000001", | ||
"Hint": "Field2", | ||
"Languages": "*", | ||
"Path": "/sitecore/content/Home/MultiLanguage", | ||
"Type": "Languages", | ||
"Value": "TransformedField2" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("YmlTransform.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("YmlTransform.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2017")] | ||
[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("bb5287ae-b720-4c65-80b0-15f4eb459ba4")] | ||
|
||
// 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")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')" /> | ||
<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>{BB5287AE-B720-4C65-80B0-15F4EB459BA4}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>YmlTransform.Tests</RootNamespace> | ||
<AssemblyName>YmlTransform.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<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' "> | ||
<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.ComponentModel.Composition" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath> | ||
</Reference> | ||
<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" /> | ||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.assert, Version=2.3.0.3820, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\xunit.assert.2.3.0\lib\netstandard1.1\xunit.assert.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.core, Version=2.3.0.3820, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\xunit.extensibility.core.2.3.0\lib\netstandard1.1\xunit.core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.execution.desktop, Version=2.3.0.3820, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL"> | ||
<HintPath>..\..\packages\xunit.extensibility.execution.2.3.0\lib\net452\xunit.execution.desktop.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="YmlTransformerTests.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\YmlTransform\YmlTransform.csproj"> | ||
<Project>{00EC6644-0EBF-44A8-8EDF-F73D06787377}</Project> | ||
<Name>YmlTransform</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<None Include="Data\Multi-Language.ymlexpected"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Data\Multi-Language.yml"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="Data\Multi-Language.ymltransform"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Analyzer Include="..\..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.props'))" /> | ||
<Error Condition="!Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.3.0\build\xunit.core.targets'))" /> | ||
</Target> | ||
<Import Project="..\..\packages\xunit.core.2.3.0\build\xunit.core.targets" Condition="Exists('..\..\packages\xunit.core.2.3.0\build\xunit.core.targets')" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.IO; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using Xunit; | ||
|
||
namespace YmlTransform.Tests | ||
{ | ||
public class YmlTransformerTests | ||
{ | ||
[Fact] | ||
public void TestMultiLanguageTranformation() | ||
{ | ||
const string originalFile = @"Data\\Multi-Language.yml"; | ||
const string expectedFile = @"Data\\Multi-Language.ymlexpected"; | ||
|
||
|
||
YmlTransformer.TransformFile(originalFile, "Data\\Multi-Language.ymltransform"); | ||
|
||
var originalHash = GetFileHash(originalFile); | ||
var expectedHash = GetFileHash(expectedFile); | ||
|
||
Assert.Equal(expectedHash, originalHash); | ||
} | ||
|
||
public string GetFileHash(string filename) | ||
{ | ||
var hash = new SHA1Managed(); | ||
var clearBytes = File.ReadAllBytes(filename); | ||
var hashedBytes = hash.ComputeHash(clearBytes); | ||
return ConvertBytesToHex(hashedBytes); | ||
} | ||
|
||
public string ConvertBytesToHex(byte[] bytes) | ||
{ | ||
var sb = new StringBuilder(); | ||
|
||
for (var i = 0; i < bytes.Length; i++) | ||
{ | ||
sb.Append(bytes[i].ToString("x")); | ||
} | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="System.Reflection" version="4.3.0" targetFramework="net462" /> | ||
<package id="System.Runtime" version="4.3.0" targetFramework="net462" /> | ||
<package id="xunit" version="2.3.0" targetFramework="net462" /> | ||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net462" /> | ||
<package id="xunit.analyzers" version="0.7.0" targetFramework="net462" /> | ||
<package id="xunit.assert" version="2.3.0" targetFramework="net462" /> | ||
<package id="xunit.core" version="2.3.0" targetFramework="net462" /> | ||
<package id="xunit.extensibility.core" version="2.3.0" targetFramework="net462" /> | ||
<package id="xunit.extensibility.execution" version="2.3.0" targetFramework="net462" /> | ||
</packages> |