2017-10-11 11:46:39 +02:00
|
|
|
|
/*
|
2018-01-16 08:24:00 +01:00
|
|
|
|
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
2017-10-11 11:46:39 +02:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using Moq;
|
2018-01-18 08:16:20 +01:00
|
|
|
|
using SafeExamBrowser.Client.Behaviour.Operations;
|
2017-10-11 11:46:39 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
|
|
|
|
using SafeExamBrowser.Contracts.WindowsApi;
|
|
|
|
|
|
2018-01-18 08:16:20 +01:00
|
|
|
|
namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations
|
2017-10-11 11:46:39 +02:00
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class ClipboardOperationTests
|
|
|
|
|
{
|
|
|
|
|
private Mock<ILogger> loggerMock;
|
|
|
|
|
private Mock<INativeMethods> nativeMethodsMock;
|
|
|
|
|
|
|
|
|
|
private ClipboardOperation sut;
|
|
|
|
|
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
loggerMock = new Mock<ILogger>();
|
|
|
|
|
nativeMethodsMock = new Mock<INativeMethods>();
|
|
|
|
|
|
2018-02-02 09:18:35 +01:00
|
|
|
|
sut = new ClipboardOperation(loggerMock.Object, nativeMethodsMock.Object);
|
2017-10-11 11:46:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void MustPerformCorrectly()
|
|
|
|
|
{
|
|
|
|
|
sut.Perform();
|
|
|
|
|
|
|
|
|
|
nativeMethodsMock.Verify(n => n.EmptyClipboard(), Times.Once);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void MustRevertCorrectly()
|
|
|
|
|
{
|
|
|
|
|
sut.Revert();
|
|
|
|
|
|
|
|
|
|
nativeMethodsMock.Verify(n => n.EmptyClipboard(), Times.Once);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|