mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
run fz test
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.FancyZones.UnitTests.Utils;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace UnitTests_FancyZones_WinAppDriver
|
||||
{
|
||||
[TestClass]
|
||||
public class RunFancyZonesTest
|
||||
{
|
||||
private static FancyZonesSession? _session;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
_session = new FancyZonesSession(testContext);
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
_session?.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RunFancyZones()
|
||||
{
|
||||
Assert.IsNotNull(_session?.FancyZonesProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace UnitTests_FancyZones_WinAppDriver
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestMethod1()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.FancyZones.UnitTests.Utils
|
||||
{
|
||||
public class FancyZonesSession : IDisposable
|
||||
{
|
||||
private const string FancyZonesPath = @"\..\..\..\PowerToys.FancyZones.exe";
|
||||
|
||||
public Process? FancyZonesProcess { get; }
|
||||
|
||||
public FancyZonesSession(TestContext testContext)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Launch FancyZones
|
||||
string? path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
path += FancyZonesPath;
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo(path);
|
||||
FancyZonesProcess = Process.Start(info);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
testContext.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
Assert.IsNotNull(FancyZonesProcess);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Close the application
|
||||
if (FancyZonesProcess != null)
|
||||
{
|
||||
FancyZonesProcess.Kill();
|
||||
FancyZonesProcess.Close();
|
||||
FancyZonesProcess.Dispose();
|
||||
}
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user