添加项目文件。
This commit is contained in:
19
TestProject1/TestProject1.csproj
Normal file
19
TestProject1/TestProject1.csproj
Normal file
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HslCommunication" Version="12.0.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
31
TestProject1/UnitTest1.cs
Normal file
31
TestProject1/UnitTest1.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using HslCommunication.Profinet.Siemens;
|
||||
|
||||
namespace TestProject1
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
SiemensS7Net plc_Conv = new SiemensS7Net(SiemensPLCS.S1500, "127.0.0.1");
|
||||
plc_Conv.ConnectTimeOut = 3;
|
||||
OperateResult res = plc_Conv.ConnectServer();
|
||||
|
||||
if (res.IsSuccess)
|
||||
{
|
||||
Console.WriteLine(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(2);
|
||||
}
|
||||
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
2
TestProject1/Usings.cs
Normal file
2
TestProject1/Usings.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
global using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
global using HslCommunication;
|
||||
Reference in New Issue
Block a user