Tests for FhSVcCtl now working

pull/250/head
dahall 2021-09-30 12:36:55 -06:00
parent 2251e5d7b1
commit b8793f4af1
2 changed files with 1 additions and 23 deletions

View File

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>UnitTest.PInvoke.FhSvcCtl</AssemblyName>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\PInvoke\FhSvcCtl\Vanara.PInvoke.FhSvcCtl.csproj" />

View File

@ -1,7 +1,5 @@
using NUnit.Framework;
using NUnit.Framework.Internal;
using System;
using System.Runtime.InteropServices;
using static Vanara.PInvoke.FhSvcCtl;
namespace Vanara.PInvoke.Tests
@ -9,23 +7,6 @@ namespace Vanara.PInvoke.Tests
[TestFixture]
public class FhSvcCtlTests
{
[OneTimeSetUp]
public void _Setup()
{
}
[DllImport(Lib.Kernel32, CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
static extern HINSTANCE LoadLibraryEx(string lpFileName, [Optional] IntPtr hFile, uint dwFlags);
[DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FreeLibrary(HINSTANCE hModule);
[OneTimeTearDown]
public void _TearDown()
{
}
[Test]
public void TestIntf()
{
@ -36,10 +17,6 @@ namespace Vanara.PInvoke.Tests
[Test]
public void TestFn()
{
HINSTANCE hi;
Assert.That(hi = LoadLibraryEx(@"C:\Windows\System32\fhsvccfg.dll", default, 0x1000), ResultIs.ValidHandle);
FreeLibrary(hi);
Assert.That(FhServiceOpenPipe(true, out var hPipe), ResultIs.Successful);
Assert.That(FhServiceReloadConfiguration(hPipe), ResultIs.Successful);
Assert.That(FhServiceStartBackup(hPipe, true), ResultIs.Successful);