diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-12-27 17:37:28 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-12-27 17:37:28 +0200 |
| commit | 78e2602610d1712bf7dfac08d082a8467bcd0210 (patch) | |
| tree | f359311fd99015057fcce86a999c60792ffa7bf0 /Software/Visual_Studio/Utilities | |
| parent | 36928d513d8091c20b248e065ef7b6a0e3bc61ee (diff) | |
| download | Tango-78e2602610d1712bf7dfac08d082a8467bcd0210.tar.gz Tango-78e2602610d1712bf7dfac08d082a8467bcd0210.zip | |
Added test to check loading segments from csv file.
Diffstat (limited to 'Software/Visual_Studio/Utilities')
6 files changed, 196 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/App.config new file mode 100644 index 000000000..4ef5218a0 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/App.config @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Program.cs new file mode 100644 index 000000000..82971cc1a --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Program.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL; +using Tango.BL.Builders; +using Tango.BL.Helpers; +using Tango.BL.DTO; +using Tango.Core.ExtensionMethods; +using Tango.Core; + +namespace Tango.CsvToJobTester.CLI +{ + public class Program + { + + static void Main(string[] args) + { + String file = "testCSV.csv"; + + DataSource _dataSource = new DataSource() + { + Address = "localhost\\SQLPPC", + Catalog = "Tango", + IntegratedSecurity = true + }; + ObservablesContext.OverrideSettingsDataSource(_dataSource); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var machine = new MachineBuilder(db).Set(x => x.SerialNumber == "LENA_TABLET").WithConfiguration().Build(); + var segments = SegmentsCsvHelper.FromFile(file, machine, db).Result; + + List<SegmentDTO> dtos = segments.Select(x => SegmentDTO.FromObservable(x)).ToList(); + + foreach (var segment in dtos) + { + Console.WriteLine(); + Console.WriteLine($"Segment {segment.SegmentIndex}"); + Console.WriteLine(segment.ToJsonString()); + } + Console.WriteLine("Press enter end test..."); + Console.ReadLine(); + } + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d96ddfb0b --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/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("Tango.CsvToJobTester.CLI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.CsvToJobTester.CLI")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[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("4747a2de-f419-41b1-95a7-e9fbb4ea0b3b")] + +// 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/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Tango.CsvToJobTester.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Tango.CsvToJobTester.CLI.csproj new file mode 100644 index 000000000..9d7d65401 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/Tango.CsvToJobTester.CLI.csproj @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <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>{4747A2DE-F419-41B1-95A7-E9FBB4EA0B3B}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.CsvToJobTester.CLI</RootNamespace> + <AssemblyName>Tango.CsvToJobTester.CLI</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <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' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Core" /> + <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" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + <None Include="TestCSV.csv"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/TestCSV.csv b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/TestCSV.csv new file mode 100644 index 000000000..0fc68a085 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/TestCSV.csv @@ -0,0 +1,9 @@ +Index,ColorSpace,Length,CatalogName1,CatalogItem1,Red1,Green1,Blue1,L1,A1,B1,Cyan1,Magenta1,Yellow1,Black1,CatalogName2,CatalogItem2,Red2,Green2,Blue2,L2,A2,B2,Cyan2,Magenta2, Yellow2,Black2 +1,LAB,100,,,,,,45,123,-12,,,,,,,,,,,,,,,, +2,Volume,200,,,,,,,,,23,34,45,56,,,100,0,0,,,,,,, +3,RGB,100,,,120,20,60,,,,,,,,,,,,,,,,,,, +4,Catalog,400,Twine,Red18,,,,,,,,,,,,,,,,,,,,,, +5,LAB,100,,,,,,0,-12,128,,,,,,,,,,12,45,89,,,, +6,Volume,200,,,,,,,,,23,34,45,56,,,100,0,0,,,,67,78,34,67 +7,RGB,100,,,120,20,60,,,,,,,,,,56,123,234,,,,,,, +8,Catalog,400,Twine,Orange22,,,,,,,,,,,Twine,Red18,,,,,,,,,, diff --git a/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/packages.config new file mode 100644 index 000000000..b3daf0d6c --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.CsvToJobTester.CLI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> +</packages>
\ No newline at end of file |
