This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.3.14.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.14.0\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.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>{11A6DC21-FA9E-4870-8875-CE837D330275}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SensorDB.Tests</RootNamespace>
<AssemblyName>SensorDB.Tests</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</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>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="NSubstitute, Version=4.2.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
<HintPath>..\packages\NSubstitute.4.2.1\lib\net46\NSubstitute.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.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" />
</ItemGroup>
<ItemGroup>
<Compile Include="IsoCodeShould.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SensorCalibrationShould.cs" />
<Compile Include="SensorDataShould.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
<Project>{e3be457c-0ac7-4a9c-bc81-eafeb3217878}</Project>
<Name>DTS.Common.Storage</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>

View File

@@ -0,0 +1,130 @@
using DTS.SensorDB;
using NUnit.Framework;
using System;
namespace SensorDB.Tests
{
[TestFixture]
public class SensorCalibrationShould
{
[Test]
public void IsCompatibleWithIEPE_ShouldReturnFalse_WhenSensorProportionalIsTrue()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.IsProportional = true;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(false));
}
[Test]
public void IsCompatibleWithIEPE_ShouldReturnFalse_WhenSensorIsNonLinear()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = true;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(false));
}
[Test]
public void IsCompatibleWithIEPE_ShouldReturnTrue()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = false;
sut.IsProportional = false;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(true));
}
[Test]
public void ToNonLinearDisplayString_ShouldReturnEmpty_WhenNonLinearIsFalse()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = false;
//Act
var compatibleWithIEPE = sut.ToNonLinearDisplayString("Test", false);
//Assert
Assert.That(compatibleWithIEPE, Is.Empty);
}
[Test]
public void ToNonLinearDisplayString_ShouldReturnEmpty_WhenNonLinearFormatIsNull()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = true;
//Act
var compatibleWithIEPE = sut.ToNonLinearDisplayString(null, false);
//Assert
Assert.That(compatibleWithIEPE, Is.Empty);
}
[Test]
public void CompareTo_ShouldReturn1_ComparedWithNull()
{
//Arange
SensorCalibration sut = new SensorCalibration();
//Act
var compatibleWithIEPE = sut.CompareTo(null);
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(1));
}
[Test]
public void CompareTo_ShouldReturn0_WhenObjectsHaveSameCalibrationDates()
{
//Arange
var now = DateTime.Now;
SensorCalibration sut = new SensorCalibration();
sut.CalibrationDate = now;
//Act
var secondObjectDate = new SensorCalibration();
secondObjectDate.CalibrationDate = now;
var compatibleWithIEPE = sut.CompareTo(secondObjectDate);
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(0));
}
[Test]
public void CompareTo_ShouldReturnNegative_WhenObjectsHaveDifferentCalibrationDates()
{
//Arange
var now = DateTime.Now;
SensorCalibration sut = new SensorCalibration();
sut.CalibrationDate = now;
//Act
var secondObjectDate = new SensorCalibration();
secondObjectDate.CalibrationDate = now.AddDays(-1);
var compatibleWithIEPE = sut.CompareTo(secondObjectDate);
//Assert
Assert.That(compatibleWithIEPE, Is.Not.EqualTo(0));
}
}
}

View File

@@ -0,0 +1,41 @@
using DTS.SensorDB;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using DTS.Common.Interface.Sensors;
using DTS.Common.Enums;
using DTS.Common.Classes.Sensors;
using DTS.Common.Enums.Sensors;
namespace SensorDB.Tests
{
[TestFixture]
public class SensorDataShould
{
[Test]
public void GetInitialEUValue_ShouldThrowException()
{
//Arrange
var sc = Substitute.For<ISensorCalibration>();
sc.NonLinear.Returns(false);
ICalibrationRecord cr = Substitute.For<ICalibrationRecord>();
cr.Excitation.Returns(ExcitationVoltageOptions.ExcitationVoltageOption.Volt2);
var list = new List<ICalibrationRecord>();
list.Add(cr);
sc.Records.Records.Returns(list.ToArray());
var io = new InitialOffset();
io.Form = InitialOffsetTypes.EUAtMV;
//Act & Assert
Assert.That(
() => SensorData.GetInitialEUValue(sc, ExcitationVoltageOptions.ExcitationVoltageOption.Volt3, io)
, Throws.TypeOf<NullReferenceException>()
.With
.Property("Message")
.EqualTo("No calibration record found for " + ExcitationVoltageOptions.ExcitationVoltageOption.Volt3.ToString()));
}
}
}

View File

@@ -0,0 +1,70 @@
using DTS.SensorDB;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SensorDB.Tests
{
[TestFixture]
public class IsoCodeShould
{
[Test]
public void TestObject_ShouldReturnQuestionMark_WhenSetToNull()
{
//Arrange
IsoCode sut = new IsoCode("");
//Act
sut.TestObject = null;
//Assert
Assert.That(sut.TestObject, Is.Not.Empty.And.EqualTo("?"));
}
[Test]
public void TestObject_ShouldReturnQuestionMark_WhenSetToEmpty()
{
//Arrange
IsoCode sut = new IsoCode("");
//Act
sut.TestObject = "";
//Assert
Assert.That(sut.TestObject, Is.EqualTo("?"));
}
[Test]
public void StringRepresentation_ShouldReturnISOCode()
{
//Arrange
IsoCode sut = new IsoCode("??RIBS0200HFFOXA");
//Act
var str = sut.StringRepresentation;
//Assert
Assert.That(str, Is.EqualTo("??RIBS0200HFFOXA"));
}
[Test]
public void StringRepresentation_ShouldReturnISOCode_WithAppendedQuestionMark()
{
//Arrange
IsoCode sut = new IsoCode("??RIBS0200HF");
//Act
var str = sut.StringRepresentation;
//Assert
Assert.That(str, Does.EndWith("????"));
Assert.That(str, Is.EqualTo("??RIBS0200HF????"));
}
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
<package id="NSubstitute" version="4.2.1" targetFramework="net461" />
<package id="NUnit" version="3.12.0" targetFramework="net461" />
<package id="NUnit3TestAdapter" version="3.14.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net461" />
</packages>

View File

@@ -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("SensorDB.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SensorDB.Tests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("11a6dc21-fa9e-4870-8875-ce837d330275")]
// 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")]

Binary file not shown.

View File

View File

@@ -0,0 +1,70 @@
using DTS.SensorDB;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SensorDB.Tests
{
[TestFixture]
public class IsoCodeShould
{
[Test]
public void TestObject_ShouldReturnQuestionMark_WhenSetToNull()
{
//Arrange
IsoCode sut = new IsoCode("");
//Act
sut.TestObject = null;
//Assert
Assert.That(sut.TestObject, Is.Not.Empty.And.EqualTo("?"));
}
[Test]
public void TestObject_ShouldReturnQuestionMark_WhenSetToEmpty()
{
//Arrange
IsoCode sut = new IsoCode("");
//Act
sut.TestObject = "";
//Assert
Assert.That(sut.TestObject, Is.EqualTo("?"));
}
[Test]
public void StringRepresentation_ShouldReturnISOCode()
{
//Arrange
IsoCode sut = new IsoCode("??RIBS0200HFFOXA");
//Act
var str = sut.StringRepresentation;
//Assert
Assert.That(str, Is.EqualTo("??RIBS0200HFFOXA"));
}
[Test]
public void StringRepresentation_ShouldReturnISOCode_WithAppendedQuestionMark()
{
//Arrange
IsoCode sut = new IsoCode("??RIBS0200HF");
//Act
var str = sut.StringRepresentation;
//Assert
Assert.That(str, Does.EndWith("????"));
Assert.That(str, Is.EqualTo("??RIBS0200HF????"));
}
}
}

View File

@@ -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("SensorDB.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SensorDB.Tests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("11a6dc21-fa9e-4870-8875-ce837d330275")]
// 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")]

View File

@@ -0,0 +1,130 @@
using DTS.SensorDB;
using NUnit.Framework;
using System;
namespace SensorDB.Tests
{
[TestFixture]
public class SensorCalibrationShould
{
[Test]
public void IsCompatibleWithIEPE_ShouldReturnFalse_WhenSensorProportionalIsTrue()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.IsProportional = true;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(false));
}
[Test]
public void IsCompatibleWithIEPE_ShouldReturnFalse_WhenSensorIsNonLinear()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = true;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(false));
}
[Test]
public void IsCompatibleWithIEPE_ShouldReturnTrue()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = false;
sut.IsProportional = false;
//Act
var compatibleWithIEPE = sut.IsCompatibleWithIEPE();
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(true));
}
[Test]
public void ToNonLinearDisplayString_ShouldReturnEmpty_WhenNonLinearIsFalse()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = false;
//Act
var compatibleWithIEPE = sut.ToNonLinearDisplayString("Test", false);
//Assert
Assert.That(compatibleWithIEPE, Is.Empty);
}
[Test]
public void ToNonLinearDisplayString_ShouldReturnEmpty_WhenNonLinearFormatIsNull()
{
//Arange
SensorCalibration sut = new SensorCalibration();
sut.NonLinear = true;
//Act
var compatibleWithIEPE = sut.ToNonLinearDisplayString(null, false);
//Assert
Assert.That(compatibleWithIEPE, Is.Empty);
}
[Test]
public void CompareTo_ShouldReturn1_ComparedWithNull()
{
//Arange
SensorCalibration sut = new SensorCalibration();
//Act
var compatibleWithIEPE = sut.CompareTo(null);
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(1));
}
[Test]
public void CompareTo_ShouldReturn0_WhenObjectsHaveSameCalibrationDates()
{
//Arange
var now = DateTime.Now;
SensorCalibration sut = new SensorCalibration();
sut.CalibrationDate = now;
//Act
var secondObjectDate = new SensorCalibration();
secondObjectDate.CalibrationDate = now;
var compatibleWithIEPE = sut.CompareTo(secondObjectDate);
//Assert
Assert.That(compatibleWithIEPE, Is.EqualTo(0));
}
[Test]
public void CompareTo_ShouldReturnNegative_WhenObjectsHaveDifferentCalibrationDates()
{
//Arange
var now = DateTime.Now;
SensorCalibration sut = new SensorCalibration();
sut.CalibrationDate = now;
//Act
var secondObjectDate = new SensorCalibration();
secondObjectDate.CalibrationDate = now.AddDays(-1);
var compatibleWithIEPE = sut.CompareTo(secondObjectDate);
//Assert
Assert.That(compatibleWithIEPE, Is.Not.EqualTo(0));
}
}
}

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit3TestAdapter.3.14.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.14.0\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.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>{11A6DC21-FA9E-4870-8875-CE837D330275}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SensorDB.Tests</RootNamespace>
<AssemblyName>SensorDB.Tests</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</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>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="NSubstitute, Version=4.2.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
<HintPath>..\packages\NSubstitute.4.2.1\lib\net46\NSubstitute.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.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" />
</ItemGroup>
<ItemGroup>
<Compile Include="IsoCodeShould.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SensorCalibrationShould.cs" />
<Compile Include="SensorDataShould.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
<Project>{e3be457c-0ac7-4a9c-bc81-eafeb3217878}</Project>
<Name>DTS.Common.Storage</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>

View File

@@ -0,0 +1,41 @@
using DTS.SensorDB;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using DTS.Common.Interface.Sensors;
using DTS.Common.Enums;
using DTS.Common.Classes.Sensors;
using DTS.Common.Enums.Sensors;
namespace SensorDB.Tests
{
[TestFixture]
public class SensorDataShould
{
[Test]
public void GetInitialEUValue_ShouldThrowException()
{
//Arrange
var sc = Substitute.For<ISensorCalibration>();
sc.NonLinear.Returns(false);
ICalibrationRecord cr = Substitute.For<ICalibrationRecord>();
cr.Excitation.Returns(ExcitationVoltageOptions.ExcitationVoltageOption.Volt2);
var list = new List<ICalibrationRecord>();
list.Add(cr);
sc.Records.Records.Returns(list.ToArray());
var io = new InitialOffset();
io.Form = InitialOffsetTypes.EUAtMV;
//Act & Assert
Assert.That(
() => SensorData.GetInitialEUValue(sc, ExcitationVoltageOptions.ExcitationVoltageOption.Volt3, io)
, Throws.TypeOf<NullReferenceException>()
.With
.Property("Message")
.EqualTo("No calibration record found for " + ExcitationVoltageOptions.ExcitationVoltageOption.Volt3.ToString()));
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
<package id="NSubstitute" version="4.2.1" targetFramework="net461" />
<package id="NUnit" version="3.12.0" targetFramework="net461" />
<package id="NUnit3TestAdapter" version="3.14.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net461" />
</packages>