Remove Port 102 dependencies from Unit Test.

- Adjust readme.
- It is no longer be necessary to shut down service s7oiehsx64.
This commit is contained in:
Serge Camille
2020-09-13 10:15:53 +02:00
parent 9198fc1686
commit 023530322e
4 changed files with 2 additions and 35 deletions

View File

@@ -25,10 +25,6 @@
<ProjectReference Include="..\S7.Net\S7.Net.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net452'">
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup>
<None Update="runtimes\win-x64\native\snap7.dll" Link="snap7.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -1,17 +1,11 @@
#region Using
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using S7.Net;
using S7.Net.UnitTest.Helpers;
using S7.Net.UnitTest;
using S7.Net.Types;
using S7.UnitTest.Helpers;
using System.Threading.Tasks;
#if NETFRAMEWORK
using System.ServiceProcess;
#endif
using System.Threading;
#endregion

View File

@@ -1,16 +1,10 @@
#region Using
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using S7.Net;
using S7.Net.UnitTest.Helpers;
using S7.Net.UnitTest;
using S7.Net.Types;
using S7.UnitTest.Helpers;
#if NETFRAMEWORK
using System.ServiceProcess;
#endif
#endregion
@@ -57,8 +51,6 @@ namespace S7.Net.UnitTest
public S7NetTests()
{
plc = CreatePlc();
//ConsoleManager.Show();
ShutDownServiceS7oiehsx64();
}
@@ -1034,20 +1026,6 @@ namespace S7.Net.UnitTest
#endregion
#region Private methods
private static void ShutDownServiceS7oiehsx64()
{
#if NETFRAMEWORK
ServiceController[] services = ServiceController.GetServices();
var service = services.FirstOrDefault(s => s.ServiceName == "s7oiehsx64");
if (service != null)
{
if (service.Status == ServiceControllerStatus.Running)
{
service.Stop();
}
}
#endif
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls