mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
New UnitTest Projects
This commit is contained in:
parent
f3fa0b8106
commit
4a80b089b4
19 changed files with 456 additions and 3 deletions
31
src/Plugin.Common.UnitTests/Plugin.Common.UnitTests.csproj
Normal file
31
src/Plugin.Common.UnitTests/Plugin.Common.UnitTests.csproj
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<RootNamespace>ServerManagerTool.Plugin.Common.UnitTests</RootNamespace>
|
||||
<AssemblyName>ServerManager.Plugin.Common.UnitTests</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Plugin.Common.UnitTests.csproj.vspscc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Plugin.Common\Plugin.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
36
src/Plugin.Common.UnitTests/PluginHelperUnitTest.cs
Normal file
36
src/Plugin.Common.UnitTests/PluginHelperUnitTest.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using ServerManagerTool.Plugin.Common;
|
||||
using ServerManagerTool.Plugin.Common.Lib;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Plugin.Common.UnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class PluginHelperUnitTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void PluginHelper_HandleAlert_When_SingleLineMessage_Then_Valid()
|
||||
{
|
||||
// Arrange
|
||||
PluginHelper.Instance.SetFetchProfileCallback(FetchProfiles);
|
||||
|
||||
// Act
|
||||
var profileList = PluginHelper.Instance.FetchProfileList();
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(profileList);
|
||||
Assert.IsTrue(profileList.Count == 3);
|
||||
}
|
||||
|
||||
public IList<Profile> FetchProfiles()
|
||||
{
|
||||
return new List<Profile>()
|
||||
{
|
||||
new Profile() { ProfileName = "Profile 1", InstallationFolder = @"d:\asmdata\servers\server1" },
|
||||
new Profile() { ProfileName = "Profile 2", InstallationFolder = @"d:\asmdata\servers\server2" },
|
||||
new Profile() { ProfileName = "Profile 3", InstallationFolder = @"d:\asmdata\servers\server3" },
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue