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 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 FileBasedPreviewHandlerTests
|
|
|
|
|
{
|
2020-09-30 01:43:18 +08:00
|
|
|
|
internal class TestFileBasedPreviewHandler : FileBasedPreviewHandler
|
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 FileBasedPreviewHandlerShouldSetFilePathWhenInitializeCalled(uint grfMode)
|
2020-08-18 01:00:56 +08:00
|
|
|
|
{
|
|
|
|
|
// Arrange
|
|
|
|
|
var fileBasedPreviewHandler = new TestFileBasedPreviewHandler();
|
|
|
|
|
var filePath = "C:\\valid-path";
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
fileBasedPreviewHandler.Initialize(filePath, grfMode);
|
|
|
|
|
|
|
|
|
|
// Assert
|
2020-10-08 04:12:59 +08:00
|
|
|
|
Assert.AreEqual(filePath, fileBasedPreviewHandler.FilePath);
|
2020-08-18 01:00:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|