105040 增加测试项目

This commit is contained in:
lihanbo 2024-10-26 14:40:28 +08:00
parent f194ff589c
commit 1539afc65e
4 changed files with 263 additions and 0 deletions

View File

@ -0,0 +1,164 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
using System.Collections.Generic;
namespace Sinvo.EplanHpD.Plugin.Test
{
[TestClass]
public class CheckTest
{
[TestMethod]
public void CheckAllTest()
{
var vm = new MainViewModel();
vm.CheckAll(new List<StuffedDataModel>
{
new StuffedDataModel
{
CheckedMsg= null,
CrossSection= "1.5",
DiscolorationDesc= "V-1.5-CE(褐色)/定制",
ErrorCount= 0,
FrontStripLength= "5.2 mm",
FrontTerminalMaterialCode= "42020100000382",
FrontTerminalModel= "C45-1.5-CE定制",
Imprint= "L1CP528",
Insulation= new InsulationModel(),
IsChecked= false,
IsError= false,
IsIgnore= false,
Model= "RV-BK-1x1.5-1224-16×N2-L1CP528",
NumberTubeContent= null,
NumberTubeMaterialNo= null,
NumberTubeSpec= null,
Quantity= 1,
RearStripLength= "8 mm",
RearTerminalMaterialCode= "42020100000427",
RearTerminalModel= "SNB2-4-CE定制",
WireCode= "42020100000188",
WireColor= "BK",
WireLength= "1224",
WireModel= "黑色RV1.5/定制",
WireName= "w_00931",
WireNumber= "L1CP528",
},
new StuffedDataModel
{
CheckedMsg= null,
CrossSection= "1.5",
DiscolorationDesc= "V-1.5-CE(褐色)/定制",
ErrorCount= 0,
FrontStripLength= "5.2 mm",
FrontTerminalMaterialCode= "42020100000382",
FrontTerminalModel= "C45-1.5-CE定制",
Imprint= "L1CP528",
Insulation= new InsulationModel(),
IsChecked= false,
IsError= false,
IsIgnore= false,
Model= "RV-BK-1x1.5-1224-16×N2-L1CP528",
NumberTubeContent= null,
NumberTubeMaterialNo= null,
NumberTubeSpec= null,
Quantity= 1,
RearStripLength= "8 mm",
RearTerminalMaterialCode= "42020100000427",
RearTerminalModel= "SNB2-4-CE定制",
WireCode= "42020100000188",
WireColor= "BK",
WireLength= "1224",
WireModel= "黑色RV1.5/定制",
WireName= "w_00931",
WireNumber= "L1CP528",
}
});
}
[TestMethod]
public void CheckAllWithDPETest()
{
var vm = new MainViewModel();
vm.CheckAll(new List<StuffedDataModel>
{
new StuffedDataModel
{
CheckedMsg= null,
CrossSection= "1.5",
DiscolorationDesc= "V-1.5-CE(褐色)/定制",
ErrorCount= 0,
FrontStripLength= "5.2 mm",
FrontTerminalMaterialCode= "42020100000382",
FrontTerminalModel= "C45-1.5-CE定制",
Imprint= "D-PECP528",
Insulation= new InsulationModel(),
IsChecked= false,
IsError= false,
IsIgnore= false,
Model= "RV-BK-1x1.5-1224-16×N2-L1CP528",
NumberTubeContent= null,
NumberTubeMaterialNo= null,
NumberTubeSpec= null,
Quantity= 1,
RearStripLength= "8 mm",
RearTerminalMaterialCode= "42020100000427",
RearTerminalModel= "SNB2-4-CE定制",
WireCode= "42020100000188",
WireColor= "BK",
WireLength= "1224",
WireModel= "黑色RV1.5/定制",
WireName= "w_00931",
WireNumber= "L1CP528",
},
new StuffedDataModel
{
CheckedMsg= null,
CrossSection= "1.5",
DiscolorationDesc= "V-1.5-CE(褐色)/定制",
ErrorCount= 0,
FrontStripLength= "5.2 mm",
FrontTerminalMaterialCode= "42020100000382",
FrontTerminalModel= "C45-1.5-CE定制",
Imprint= "D-PECP528",
Insulation= new InsulationModel(),
IsChecked= false,
IsError= false,
IsIgnore= false,
Model= "RV-BK-1x1.5-1224-16×N2-L1CP528",
NumberTubeContent= null,
NumberTubeMaterialNo= null,
NumberTubeSpec= null,
Quantity= 1,
RearStripLength= "8 mm",
RearTerminalMaterialCode= "42020100000427",
RearTerminalModel= "SNB2-4-CE定制",
WireCode= "42020100000188",
WireColor= "BK",
WireLength= "1224",
WireModel= "黑色RV1.5/定制",
WireName= "w_00931",
WireNumber= "L1CP528",
}
});
}
[TestMethod]
public void CheckTerminalsTest()
{
var vm = new MainViewModel();
var stuffedData = new StuffedDataModel
{
Imprint = "D-PE1231231",
WireModel = "黄绿色RV0.5-CE定制",
FrontTerminalModel = "AC45-1.5-CE定制",
RearTerminalModel = "RNB2-5-CE定制",
};
vm.CheckTerminals(stuffedData);
Assert.IsFalse(!stuffedData.IsError);
}
}
}

View File

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Sinvo.EplanHpD.Plugin.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sinvo.EplanHpD.Plugin.Test")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("aec39474-528b-4da8-b650-99189acb7a2c")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.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>{AEC39474-528B-4DA8-B650-99189ACB7A2C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sinvo.EplanHpD.Plugin.Test</RootNamespace>
<AssemblyName>Sinvo.EplanHpD.Plugin.Test</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
</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>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="CheckTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sinvo.EplanHpD.Plugin.WPFUI\Sinvo.EplanHpD.Plugin.WPFUI.csproj">
<Project>{2dbcd22a-650d-4797-9908-9c4d5d6665fe}</Project>
<Name>Sinvo.EplanHpD.Plugin.WPFUI</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.2.10" targetFramework="net481" />
<package id="MSTest.TestFramework" version="2.2.10" targetFramework="net481" />
</packages>