PowerToys/src/modules/previewpane/UnitTests-PreviewHandlerCommon/StreamBasedPreviewHandlerTests.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2020-08-18 01:00:56 +08:00
// 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;
2020-09-30 01:43:18 +08:00
namespace PreviewHandlerCommonUnitTests
2020-08-18 01:00:56 +08:00
{
[TestClass]
public class StreamBasedPreviewHandlerTests
{
2020-09-30 01:43:18 +08:00
internal class TestStreamBasedPreviewHandler : StreamBasedPreviewHandler
2020-08-18 01:00:56 +08:00
{
public override void DoPreview()
{
throw new NotImplementedException();
}
protected override IPreviewHandlerControl CreatePreviewHandlerControl()
{
return new Mock<IPreviewHandlerControl>().Object;
}
}
[DataTestMethod]
[DataRow(0U)]
[DataRow(1U)]
2020-09-30 01:43:18 +08:00
public void StreamBasedPreviewHandlerShouldSetStreamWhenInitializeCalled(uint grfMode)
2020-08-18 01:00:56 +08:00
{
// Arrange
var streamBasedPreviewHandler = new TestStreamBasedPreviewHandler();
var stream = new Mock<IStream>().Object;
// Act
streamBasedPreviewHandler.Initialize(stream, grfMode);
// Assert
Assert.AreEqual(stream, streamBasedPreviewHandler.Stream);
2020-08-18 01:00:56 +08:00
}
}
}