mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-23 09:53:50 +08:00
38d537bb8a
* Enable Unit tests for PreviewPane Test Assemblies in CI * Added Preview handlers unit tests project back * throw for Svg to debug tests * Removed failing test * Removed throw statement * Added MD unitests in yml * Run ui tests on STA thread * Throw svg to debug failing tests * Updated test adaptor * Removed failing test to validate CI * throw svg failing test with full stack trace * Check if mock stream is causing the issue * narrow down the failing tests code - 1 * narrow down the failing tests code -2 * dispose all controls * Restore SVg preview control * Update test adaptor and dependency to latest
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
// 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.Runtime.InteropServices.ComTypes;
|
|
using Common;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Moq;
|
|
|
|
namespace UnitTests_PreviewHandlerCommon
|
|
{
|
|
[TestClass]
|
|
public class StreamBasedPreviewHandlerTests
|
|
{
|
|
public class TestStreamBasedPreviewHandler : StreamBasedPreviewHandler
|
|
{
|
|
public override void DoPreview()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
protected override IPreviewHandlerControl CreatePreviewHandlerControl()
|
|
{
|
|
return new Mock<IPreviewHandlerControl>().Object;
|
|
}
|
|
}
|
|
|
|
[DataTestMethod]
|
|
[DataRow((uint)0)]
|
|
[DataRow((uint)1)]
|
|
public void StreamBasedPreviewHandler_ShouldSetStream_WhenInitializeCalled(uint grfMode)
|
|
{
|
|
// Arrange
|
|
var streamBasedPreviewHandler = new TestStreamBasedPreviewHandler();
|
|
var stream = new Mock<IStream>().Object;
|
|
|
|
// Act
|
|
streamBasedPreviewHandler.Initialize(stream, grfMode);
|
|
|
|
// Assert
|
|
Assert.AreEqual(streamBasedPreviewHandler.Stream, stream);
|
|
}
|
|
}
|
|
}
|