PL lang fix, camera test

This commit is contained in:
Michal Buzik 2024-03-10 22:25:55 +01:00
parent 6a428e3c76
commit a710ab7457
7 changed files with 126 additions and 4 deletions

View File

@ -17,7 +17,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LANG_PL</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@ -25,7 +25,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LANG_PL</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View File

@ -21,6 +21,9 @@ namespace Config.Mappings
Map(x => x.PressMtrUp);
Map(x => x.PressMtrDown);
Map(x => x.PressMtrDelta);
//Map(x => x.ElectricMtrUp);
//Map(x => x.ElectricMtrDown);
//Map(x => x.ElectricMtrDelta);
Map(x => x.StopBFValve);
Map(x => x.ValvesOpen)
.CustomType("StringClob")

View File

@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LANG_PL</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LANG_PL</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>

View File

@ -0,0 +1,93 @@
using System.IO;
using System.Reflection;
using System.Threading;
using JetBrains.Annotations;
using log4net;
using log4net.Config;
using log4net.Repository;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TBF.Rig.Generic;
using TBF.Rig.Network.Camera.KeyenceIV3G120;
using System.Xml;
namespace TBFTests.Rig.Network.Camera.KeyenceIV3G120
{
public class Log4NetSetup
{
public static void ConfigureLog4Net()
{
// Construct the log4net configuration as a string
string log4netConfig = @"
<log4net>
<appender name='ConsoleAppender' type='log4net.Appender.ConsoleAppender'>
<layout type='log4net.Layout.PatternLayout'>
<conversionPattern value='%date %-5level %logger - %message%newline' />
</layout>
</appender>
<root>
<level value='ALL' />
<appender-ref ref='ConsoleAppender' />
</root>
</log4net>";
// Load the log4net configuration from the string
XmlDocument doc = new XmlDocument();
doc.LoadXml(log4netConfig);
XmlElement element = doc.DocumentElement;
// Get the current assembly for the repository
Assembly assembly = Assembly.GetExecutingAssembly();
// Configure log4net using the parsed XmlElement
ILoggerRepository logRepository = LogManager.GetRepository(assembly);
XmlConfigurator.Configure(logRepository, element);
}
}
[TestClass]
[TestSubject(typeof(TBF.Rig.Network.Camera.KeyenceIV3G120.Camera))]
public class CameraTest
{
[TestInitialize]
public void Setup()
{
// Configure Log4Net programmatically
Log4NetSetup.ConfigureLog4Net();
}
[TestMethod]
public void Initialize()
{
Factory factory = new Factory();
IComponentCfg config = new CameraCfg("Camera0", factory);
TBF.Rig.Network.Camera.KeyenceIV3G120.Camera camera = new TBF.Rig.Network.Camera.KeyenceIV3G120.Camera(config, null);
camera.Initialize();
Thread.Sleep(10000);
camera.Stop();
Thread.Sleep(10000);
}
[TestMethod]
public void RtpListener()
{
Factory factory = new Factory();
IComponentCfg config = new CameraCfg("Camera0", factory);
TBF.Rig.Network.Camera.KeyenceIV3G120.Camera camera = new TBF.Rig.Network.Camera.KeyenceIV3G120.Camera(config, null);
camera.RtpListener();
camera.Stop();
}
}
}

View File

@ -0,0 +1,19 @@
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TBF.Rig.Network.Camera.RoiForFixedStartKeyence;
namespace TBFTests.Rig.Network.Camera.RoiForFixedStartKeyence
{
[TestClass]
[TestSubject(typeof(Roi))]
public class RoiTest
{
[TestMethod]
public void Valve()
{
Roi roi = new Roi();
}
}
}

View File

@ -44,6 +44,9 @@
<Reference Include="JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2023.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
@ -81,6 +84,7 @@
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -93,6 +97,8 @@
<ItemGroup>
<Compile Include="Entities\MeasurementCorrectionTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rig\Network\Camera\KeyenceIV3G120\CameraTest.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartKeyence\RoiTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

View File

@ -13,4 +13,5 @@
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="log4net" version="2.0.15" targetFramework="net472" />
</packages>