添加了测试WPF的单元测试
This commit is contained in:
33
DMS.WPF.UnitTests/DMS.WPF.UnitTests.csproj
Normal file
33
DMS.WPF.UnitTests/DMS.WPF.UnitTests.csproj
Normal file
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||
<PackageReference Include="Bogus" Version="35.6.3" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2025.1.0-eap1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="Moq" Version="4.20.72" />
|
||||
<PackageReference Include="xunit" Version="2.5.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DMS.Application\DMS.Application.csproj" />
|
||||
<ProjectReference Include="..\DMS.WPF\DMS.WPF.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
DMS.WPF.UnitTests/UnitTest1.cs
Normal file
10
DMS.WPF.UnitTests/UnitTest1.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace DMS.WPF.UnitTests;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
36
DMS.WPF.UnitTests/ViewModelTest/DevicesViewModelTests.cs
Normal file
36
DMS.WPF.UnitTests/ViewModelTest/DevicesViewModelTests.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using AutoMapper;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.WPF.Services;
|
||||
using DMS.WPF.ViewModels;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moq;
|
||||
|
||||
namespace DMS.WPF.UnitTests.ViewModelTest
|
||||
{
|
||||
public class DevicesViewModelTests:BaseServiceTest
|
||||
{
|
||||
private readonly DevicesViewModel _devicesViewModel;
|
||||
|
||||
|
||||
public DevicesViewModelTests()
|
||||
{
|
||||
_devicesViewModel= ServiceProvider.GetRequiredService<DevicesViewModel>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AddDevice_Test()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
await _devicesViewModel.AddDevice();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user