init
This commit is contained in:
1
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/entries
Normal file
1
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/format
Normal file
1
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,134 @@
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using DTS.SensorDB;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Common.Import.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CalibrationImportShould
|
||||
{
|
||||
[Test]
|
||||
public void CheckForExcitationCalibration_ShouldReturnSameSensorCalibration_OnEqualExcitation()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records= NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt1;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.CheckForExcitationCalibration(sensorCalibration, 0, ExcitationVoltageOptions.ExcitationVoltageOption.Volt1, "");
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckForExcitationCalibration_ShouldReturnSameSensorCalibration_OnNotEqualExcitation()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.CheckForExcitationCalibration(sensorCalibration, 0, ExcitationVoltageOptions.ExcitationVoltageOption.Volt1, "");
|
||||
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearCalRecordIfNeeded_ShouldReturnSameSensorCalibrationIfRecordsLengthNot1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
record.Poly.MarkValid(true);
|
||||
var record2 = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record,record2 }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearCalRecordIfNeeded(sensorCalibration, false, false);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records[0].Poly.IsValid,Is.True);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearCalRecordIfNeeded_ShouldReturnNotValidPolySensorCalibrationIfRecordsLengthIs1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearCalRecordIfNeeded(sensorCalibration, false, false);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records[0].Poly.IsValid, Is.False);
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AddLinearZeroMethodIfNeeded_ShouldReturnSameSensorCalibrationIfRecordsLengthNot1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
record.Poly.MarkValid(true);
|
||||
var record2 = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record, record2 }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearZeroMethodIfNeeded(sensorCalibration, Common.Enums.Sensors.ZeroMethodType.None, 0,1);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearZeroMethodIfNeeded_ShouldReturnZeroMethodsMethodsAdded()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearZeroMethodIfNeeded(sensorCalibration, Common.Enums.Sensors.ZeroMethodType.None, 0, 1);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.ZeroMethods.Methods.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("DTS.Common.Import.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DTS.Common.Import.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[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("38a471f6-c94f-4ae1-8ef5-d49f309bb3c2")]
|
||||
|
||||
// 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")]
|
||||
@@ -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="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{38A471F6-C94F-4AE1-8EF5-D49F309BB3C2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DTS.Common.Import.Tests</RootNamespace>
|
||||
<AssemblyName>DTS.Common.Import.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NSubstitute">
|
||||
<HintPath>..\..\packages\NSubstitute.4.2.1\lib\net46\NSubstitute.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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="CalibrationImportShould.cs" />
|
||||
<Compile Include="GroupHelperShould.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common.DataModel\DTS.Common.DataModel.csproj">
|
||||
<Project>{2a2f03a9-bf85-4360-a06a-cf3016d2633b}</Project>
|
||||
<Name>DTS.Common.DataModel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common.Import\DTS.Common.Import.csproj">
|
||||
<Project>{c1bc06f4-8657-4892-bc4d-1064da01c4c7}</Project>
|
||||
<Name>DTS.Common.Import</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{f7a0804f-61a4-40ae-83d0-f1137622b592}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Users\Users.csproj">
|
||||
<Project>{be8d217d-6da9-4bca-b62a-a82325b33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
using DataPROWin7.DataModel;
|
||||
using DTS.Common.Interface.TestSetups.TestSetupsList;
|
||||
using DTS.SensorDB;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Common.Import.Tests
|
||||
{
|
||||
class GroupHelperShould
|
||||
{
|
||||
[Test]
|
||||
public void CreateEmptyGroup_ShouldCreateNewGroup()
|
||||
{
|
||||
var res = GroupHelper.CreateEmptyGroup();
|
||||
Assert.That(res.LastModifiedBy, Is.EqualTo("---"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReverseChannelOrder_ShouldNotThorwExceptionOnNullTestTemplate()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("1", "a");
|
||||
var sens = NSubstitute.Substitute.For<SensorData>();
|
||||
var res = GroupHelper.ReverseChannelOrder(null, dict, new List<SensorDB.SensorData> { sens });
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReverseChannelOrder_ShouldNotThorwExceptionOnNullSensors()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("1", "a");
|
||||
|
||||
var res = GroupHelper.ReverseChannelOrder(null, dict,null);
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NormalizeSensorIds_ShouldNotThorwExceptionOnNullSensors()
|
||||
{
|
||||
var res = GroupHelper.NormalizeSensorIds(null);
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/wc.db
Normal file
BIN
DataPRO/UnitTest/DTS.Common.Import.Tests/.svn/wc.db
Normal file
Binary file not shown.
@@ -0,0 +1,134 @@
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using DTS.SensorDB;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Common.Import.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class CalibrationImportShould
|
||||
{
|
||||
[Test]
|
||||
public void CheckForExcitationCalibration_ShouldReturnSameSensorCalibration_OnEqualExcitation()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records= NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt1;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.CheckForExcitationCalibration(sensorCalibration, 0, ExcitationVoltageOptions.ExcitationVoltageOption.Volt1, "");
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckForExcitationCalibration_ShouldReturnSameSensorCalibration_OnNotEqualExcitation()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.CheckForExcitationCalibration(sensorCalibration, 0, ExcitationVoltageOptions.ExcitationVoltageOption.Volt1, "");
|
||||
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearCalRecordIfNeeded_ShouldReturnSameSensorCalibrationIfRecordsLengthNot1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
record.Poly.MarkValid(true);
|
||||
var record2 = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record,record2 }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearCalRecordIfNeeded(sensorCalibration, false, false);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records[0].Poly.IsValid,Is.True);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearCalRecordIfNeeded_ShouldReturnNotValidPolySensorCalibrationIfRecordsLengthIs1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearCalRecordIfNeeded(sensorCalibration, false, false);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records[0].Poly.IsValid, Is.False);
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AddLinearZeroMethodIfNeeded_ShouldReturnSameSensorCalibrationIfRecordsLengthNot1()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
record.Poly.MarkValid(true);
|
||||
var record2 = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record, record2 }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearZeroMethodIfNeeded(sensorCalibration, Common.Enums.Sensors.ZeroMethodType.None, 0,1);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.Records.Records.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddLinearZeroMethodIfNeeded_ShouldReturnZeroMethodsMethodsAdded()
|
||||
{
|
||||
CalibrationImport sut = new CalibrationImport();
|
||||
var sensorCalibration = new SensorCalibration();
|
||||
var records = NSubstitute.Substitute.For<ICalibrationRecords>();
|
||||
var record = NSubstitute.Substitute.For<ICalibrationRecord>();
|
||||
record.Poly = new Classes.Sensors.LinearizationFormula();
|
||||
|
||||
record.Excitation = ExcitationVoltageOptions.ExcitationVoltageOption.Volt2;
|
||||
records.Records = new List<ICalibrationRecord> { record }.ToArray();
|
||||
sensorCalibration.Records = records;
|
||||
|
||||
var res = sut.AddLinearZeroMethodIfNeeded(sensorCalibration, Common.Enums.Sensors.ZeroMethodType.None, 0, 1);
|
||||
|
||||
Assert.That(res, Is.EqualTo(sensorCalibration));
|
||||
Assert.That(res.ZeroMethods.Methods.Count, Is.EqualTo(2));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{38A471F6-C94F-4AE1-8EF5-D49F309BB3C2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DTS.Common.Import.Tests</RootNamespace>
|
||||
<AssemblyName>DTS.Common.Import.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NSubstitute">
|
||||
<HintPath>..\..\packages\NSubstitute.4.2.1\lib\net46\NSubstitute.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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="CalibrationImportShould.cs" />
|
||||
<Compile Include="GroupHelperShould.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common.DataModel\DTS.Common.DataModel.csproj">
|
||||
<Project>{2a2f03a9-bf85-4360-a06a-cf3016d2633b}</Project>
|
||||
<Name>DTS.Common.DataModel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common.Import\DTS.Common.Import.csproj">
|
||||
<Project>{c1bc06f4-8657-4892-bc4d-1064da01c4c7}</Project>
|
||||
<Name>DTS.Common.Import</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\DTS.Common\DTS.Common.csproj">
|
||||
<Project>{f7a0804f-61a4-40ae-83d0-f1137622b592}</Project>
|
||||
<Name>DTS.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Users\Users.csproj">
|
||||
<Project>{be8d217d-6da9-4bca-b62a-a82325b33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
using DataPROWin7.DataModel;
|
||||
using DTS.Common.Interface.TestSetups.TestSetupsList;
|
||||
using DTS.SensorDB;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Common.Import.Tests
|
||||
{
|
||||
class GroupHelperShould
|
||||
{
|
||||
[Test]
|
||||
public void CreateEmptyGroup_ShouldCreateNewGroup()
|
||||
{
|
||||
var res = GroupHelper.CreateEmptyGroup();
|
||||
Assert.That(res.LastModifiedBy, Is.EqualTo("---"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReverseChannelOrder_ShouldNotThorwExceptionOnNullTestTemplate()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("1", "a");
|
||||
var sens = NSubstitute.Substitute.For<SensorData>();
|
||||
var res = GroupHelper.ReverseChannelOrder(null, dict, new List<SensorDB.SensorData> { sens });
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReverseChannelOrder_ShouldNotThorwExceptionOnNullSensors()
|
||||
{
|
||||
var dict = new Dictionary<string, string>();
|
||||
dict.Add("1", "a");
|
||||
|
||||
var res = GroupHelper.ReverseChannelOrder(null, dict,null);
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NormalizeSensorIds_ShouldNotThorwExceptionOnNullSensors()
|
||||
{
|
||||
var res = GroupHelper.NormalizeSensorIds(null);
|
||||
Assert.That(res.Count, Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("DTS.Common.Import.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DTS.Common.Import.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[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("38a471f6-c94f-4ae1-8ef5-d49f309bb3c2")]
|
||||
|
||||
// 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")]
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
f8502a9d2c5c989efd146c062830cc7b4b1ea490
|
||||
@@ -0,0 +1,2 @@
|
||||
D:\DTS\Code\DP\BRANCH_MAINT_4_04\DataPRO\UnitTest\DTS.Common.Import.Tests\obj\Debug\DTS.Common.Import.Tests.csproj.AssemblyReference.cache
|
||||
D:\DTS\Code\DP\BRANCH_MAINT_4_04\DataPRO\UnitTest\DTS.Common.Import.Tests\obj\Debug\DTS.Common.Import.Tests.csproj.CoreCompileInputs.cache
|
||||
Binary file not shown.
Reference in New Issue
Block a user