Skip to content

Commit

Permalink
PR 47: Merge AddTests to master +semver:minor
Browse files Browse the repository at this point in the history
 - At thest the engine does not break +semver:minor
 - Updated with new Link processing to bring across both Hyperlinks and Git
 - Fixed name of assembly for perfoamnce counters +semver:patch
 - Updated with small fixes for casing of commit messgaes which is inconsistant.
 - Merge branch 'master'
 - Added Unit tests for both config and engine
 - Updated with json seralise and deserilise
  • Loading branch information
MrHinsh committed Aug 19, 2016
1 parent e3e057f commit cd6be3b
Show file tree
Hide file tree
Showing 11 changed files with 416 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TfsWitMigrator.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace VSTS.DataBulkEditor.ConsoleApp
{
class Program
public class Program
{
[Verb("init", HelpText = "Creates initial config file")]
class InitOptions
Expand All @@ -39,7 +39,7 @@ class RunOptions
public string ConfigFile { get; set; }
}

static int Main(string[] args)
public static int Main(string[] args)
{
Telemetry.Current.TrackEvent("ApplicationStart");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Expand Down
38 changes: 38 additions & 0 deletions VSTS.DataBulkEditor.Console.Tests/ProgramTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using VSTS.DataBulkEditor.Engine.Configuration;
using VSTS.DataBulkEditor.Engine.Configuration.FieldMap;
using System.IO;

namespace VSTS.DataBulkEditor.Console.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void TestSeraliseToJson()
{
string json = JsonConvert.SerializeObject(EngineConfiguration.GetDefault(),
new FieldMapConfigJsonConverter(),
new ProcessorConfigJsonConverter());
StreamWriter sw = new StreamWriter("vstsbulkeditor.json");
sw.WriteLine(json);
sw.Close();

}

[TestMethod]
public void TestDeseraliseFromJson()
{
EngineConfiguration ec;
StreamReader sr = new StreamReader("vstsbulkeditor.json");
string vstsbulkeditorjson = sr.ReadToEnd();
sr.Close();
ec = JsonConvert.DeserializeObject<EngineConfiguration>(vstsbulkeditorjson,
new FieldMapConfigJsonConverter(),
new ProcessorConfigJsonConverter());

}
}
}
36 changes: 36 additions & 0 deletions VSTS.DataBulkEditor.Console.Tests/Properties/AssemblyInfo.cs
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("VSTS.DataBulkEditor.Console.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VSTS.DataBulkEditor.Console.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("985259ea-c475-4918-9342-50ab744f52af")]

// 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")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{985259EA-C475-4918-9342-50AB744F52AF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VSTS.DataBulkEditor.Console.Tests</RootNamespace>
<AssemblyName>VSTS.DataBulkEditor.Console.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</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="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="ProgramTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TfsWitMigrator.Console\VSTS.DataBulkEditor.Console.csproj">
<Project>{033eb332-4a50-4c73-9b7d-a35d9f3c0513}</Project>
<Name>VSTS.DataBulkEditor.Console</Name>
</ProjectReference>
<ProjectReference Include="..\TfsWitMigrator.Core\_VSTS.DataBulkEditor.Engine.csproj">
<Project>{68baf6ba-2bc0-48d0-b892-1d9f93d7003a}</Project>
<Name>_VSTS.DataBulkEditor.Engine</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
23 changes: 23 additions & 0 deletions VSTS.DataBulkEditor.Console.Tests/app.config
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="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.10.0.0" newVersion="3.10.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.ServiceBus" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 4 additions & 0 deletions VSTS.DataBulkEditor.Console.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
</packages>
12 changes: 12 additions & 0 deletions VSTS.DataBulkEditor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "configurations", "configura
configurations\demo-migration.json = configurations\demo-migration.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_VSTS.DataBulkEditor.Engine.Tests", "_VSTS.DataBulkEditor.Engine.Tests\_VSTS.DataBulkEditor.Engine.Tests.csproj", "{AB3922F0-E801-474A-A498-892C3EA99799}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VSTS.DataBulkEditor.Console.Tests", "VSTS.DataBulkEditor.Console.Tests\VSTS.DataBulkEditor.Console.Tests.csproj", "{985259EA-C475-4918-9342-50AB744F52AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,6 +38,14 @@ Global
{68BAF6BA-2BC0-48D0-B892-1D9F93D7003A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68BAF6BA-2BC0-48D0-B892-1D9F93D7003A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68BAF6BA-2BC0-48D0-B892-1D9F93D7003A}.Release|Any CPU.Build.0 = Release|Any CPU
{AB3922F0-E801-474A-A498-892C3EA99799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB3922F0-E801-474A-A498-892C3EA99799}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB3922F0-E801-474A-A498-892C3EA99799}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB3922F0-E801-474A-A498-892C3EA99799}.Release|Any CPU.Build.0 = Release|Any CPU
{985259EA-C475-4918-9342-50AB744F52AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{985259EA-C475-4918-9342-50AB744F52AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{985259EA-C475-4918-9342-50AB744F52AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{985259EA-C475-4918-9342-50AB744F52AF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
32 changes: 32 additions & 0 deletions _VSTS.DataBulkEditor.Engine.Tests/EngineConfigurationTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VSTS.DataBulkEditor.Engine.Configuration;

namespace _VSTS.DataBulkEditor.Engine.Tests
{
[TestClass]
public class EngineConfigurationTests
{
[TestMethod]
public void EngineConfigurationCreate()
{
EngineConfiguration ec = new EngineConfiguration();
ec.TelemetryEnableTrace = true;
ec.Source = new TeamProjectConfig() { Name = "DemoProjs", Collection = new Uri("https://sdd2016.visualstudio.com/") };
ec.Target = new TeamProjectConfig() { Name = "DemoProjt", Collection = new Uri("https://sdd2016.visualstudio.com/") };
ec.ReflectedWorkItemIDFieldName = "TfsMigrationTool.ReflectedWorkItemId";
Assert.IsNotNull(ec);
Assert.IsNotNull(ec.Source);
Assert.AreEqual(ec.Source.Name, "DemoProjs");
}

[TestMethod]
public void EngineConfigurationCreateDefault()
{
EngineConfiguration ec = EngineConfiguration.GetDefault();
Assert.IsNotNull(ec);
Assert.IsNotNull(ec.Source);
Assert.AreEqual(ec.Source.Name, "DemoProjs");
}
}
}
40 changes: 40 additions & 0 deletions _VSTS.DataBulkEditor.Engine.Tests/MigrationEngineTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VSTS.DataBulkEditor.Engine;
using VSTS.DataBulkEditor.Engine.Configuration;

namespace _VSTS.DataBulkEditor.Engine.Tests
{
[TestClass]
public class MigrationEngineTests
{
[TestMethod]
public void TestEngineCreation()
{
EngineConfiguration ec = EngineConfiguration.GetDefault();
MigrationEngine me = new MigrationEngine(ec);
}

[TestMethod]
public void TestEngineExecuteEmptyProcessors()
{
EngineConfiguration ec = EngineConfiguration.GetDefault();
ec.Processors.Clear();
MigrationEngine me = new MigrationEngine(ec);
me.Run();

}

[TestMethod]
public void TestEngineExecuteEmptyFieldMaps()
{
EngineConfiguration ec = EngineConfiguration.GetDefault();
ec.Processors.Clear();
ec.FieldMaps.Clear();
MigrationEngine me = new MigrationEngine(ec);
me.Run();
}


}
}
36 changes: 36 additions & 0 deletions _VSTS.DataBulkEditor.Engine.Tests/Properties/AssemblyInfo.cs
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("_VSTS.DataBulkEditor.Engine.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("_VSTS.DataBulkEditor.Engine.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("ab3922f0-e801-474a-a498-892c3ea99799")]

// 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")]
Loading

0 comments on commit cd6be3b

Please sign in to comment.