diff --git a/TfsWitMigrator.Console/Program.cs b/TfsWitMigrator.Console/Program.cs index 1e1979e0e..fae05865f 100644 --- a/TfsWitMigrator.Console/Program.cs +++ b/TfsWitMigrator.Console/Program.cs @@ -25,7 +25,7 @@ namespace VSTS.DataBulkEditor.ConsoleApp { - class Program + public class Program { [Verb("init", HelpText = "Creates initial config file")] class InitOptions @@ -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; diff --git a/VSTS.DataBulkEditor.Console.Tests/ProgramTests.cs b/VSTS.DataBulkEditor.Console.Tests/ProgramTests.cs new file mode 100644 index 000000000..b66a3fd3e --- /dev/null +++ b/VSTS.DataBulkEditor.Console.Tests/ProgramTests.cs @@ -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(vstsbulkeditorjson, + new FieldMapConfigJsonConverter(), + new ProcessorConfigJsonConverter()); + + } + } +} diff --git a/VSTS.DataBulkEditor.Console.Tests/Properties/AssemblyInfo.cs b/VSTS.DataBulkEditor.Console.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..a3d198af7 --- /dev/null +++ b/VSTS.DataBulkEditor.Console.Tests/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("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")] diff --git a/VSTS.DataBulkEditor.Console.Tests/VSTS.DataBulkEditor.Console.Tests.csproj b/VSTS.DataBulkEditor.Console.Tests/VSTS.DataBulkEditor.Console.Tests.csproj new file mode 100644 index 000000000..bca390637 --- /dev/null +++ b/VSTS.DataBulkEditor.Console.Tests/VSTS.DataBulkEditor.Console.Tests.csproj @@ -0,0 +1,101 @@ + + + + Debug + AnyCPU + {985259EA-C475-4918-9342-50AB744F52AF} + Library + Properties + VSTS.DataBulkEditor.Console.Tests + VSTS.DataBulkEditor.Console.Tests + v4.5.2 + 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 + + + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll + True + + + + + + + + + + + + + + + + + + + + + + {033eb332-4a50-4c73-9b7d-a35d9f3c0513} + VSTS.DataBulkEditor.Console + + + {68baf6ba-2bc0-48d0-b892-1d9f93d7003a} + _VSTS.DataBulkEditor.Engine + + + + + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/VSTS.DataBulkEditor.Console.Tests/app.config b/VSTS.DataBulkEditor.Console.Tests/app.config new file mode 100644 index 000000000..2cc38cf14 --- /dev/null +++ b/VSTS.DataBulkEditor.Console.Tests/app.config @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VSTS.DataBulkEditor.Console.Tests/packages.config b/VSTS.DataBulkEditor.Console.Tests/packages.config new file mode 100644 index 000000000..1975352b1 --- /dev/null +++ b/VSTS.DataBulkEditor.Console.Tests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/VSTS.DataBulkEditor.sln b/VSTS.DataBulkEditor.sln index 48d0caff7..7fae1eef3 100644 --- a/VSTS.DataBulkEditor.sln +++ b/VSTS.DataBulkEditor.sln @@ -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 @@ -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 diff --git a/_VSTS.DataBulkEditor.Engine.Tests/EngineConfigurationTests.cs b/_VSTS.DataBulkEditor.Engine.Tests/EngineConfigurationTests.cs new file mode 100644 index 000000000..95d63cf79 --- /dev/null +++ b/_VSTS.DataBulkEditor.Engine.Tests/EngineConfigurationTests.cs @@ -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"); + } + } +} diff --git a/_VSTS.DataBulkEditor.Engine.Tests/MigrationEngineTests.cs b/_VSTS.DataBulkEditor.Engine.Tests/MigrationEngineTests.cs new file mode 100644 index 000000000..0cf050344 --- /dev/null +++ b/_VSTS.DataBulkEditor.Engine.Tests/MigrationEngineTests.cs @@ -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(); + } + + + } +} diff --git a/_VSTS.DataBulkEditor.Engine.Tests/Properties/AssemblyInfo.cs b/_VSTS.DataBulkEditor.Engine.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..852702749 --- /dev/null +++ b/_VSTS.DataBulkEditor.Engine.Tests/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("_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")] diff --git a/_VSTS.DataBulkEditor.Engine.Tests/_VSTS.DataBulkEditor.Engine.Tests.csproj b/_VSTS.DataBulkEditor.Engine.Tests/_VSTS.DataBulkEditor.Engine.Tests.csproj new file mode 100644 index 000000000..81efdf0f0 --- /dev/null +++ b/_VSTS.DataBulkEditor.Engine.Tests/_VSTS.DataBulkEditor.Engine.Tests.csproj @@ -0,0 +1,92 @@ + + + + Debug + AnyCPU + {AB3922F0-E801-474A-A498-892C3EA99799} + Library + Properties + _VSTS.DataBulkEditor.Engine.Tests + _VSTS.DataBulkEditor.Engine.Tests + v4.5.2 + 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 + + + + + + + + + + + + + + False + + + + + + + + + + + + {68baf6ba-2bc0-48d0-b892-1d9f93d7003a} + _VSTS.DataBulkEditor.Engine + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file