public void PreviewHandlerBase_ShouldDirectKeyStrokesToIPreviewHandlerFrame_IfIPreviewHandlerFrameIsSet()
        {
            // Arrange
            var mockPreviewControl      = new Mock <IPreviewHandlerControl>();
            var mockPreviewHandlerFrame = new Mock <IPreviewHandlerFrame>();
            var msg = new MSG();

            previewHandlerControl = mockPreviewControl.Object;
            var testPreviewHandler = new TestPreviewHandler();

            testPreviewHandler.SetSite(mockPreviewHandlerFrame.Object);

            // Act
            testPreviewHandler.TranslateAccelerator(ref msg);

            // Assert
            mockPreviewHandlerFrame.Verify(_ => _.TranslateAccelerator(ref msg), Times.Once);
        }
Ejemplo n.º 2
0
        public void PreviewHandlerBaseShouldReturnSiteWhenGetSiteCalled()
        {
            // Arrange
            var mockPreviewControl = new Mock <IPreviewHandlerControl>();

            previewHandlerControl = mockPreviewControl.Object;
            var testPreviewHandler = new TestPreviewHandler();
            var site = new Mock <IPreviewHandlerFrame>().Object;

            testPreviewHandler.SetSite(site);
            var riid = Guid.Empty;

            // Act
            testPreviewHandler.GetSite(ref riid, out object actualSite);

            // Assert
            Assert.AreEqual(actualSite, site);
        }
        public void PreviewHandlerBase_ShouldReturnIPreviewHandlerFrameResponse_IfIPreviewHandlerFrameIsSet(uint resultCode)
        {
            // Arrange
            var mockPreviewControl      = new Mock <IPreviewHandlerControl>();
            var mockPreviewHandlerFrame = new Mock <IPreviewHandlerFrame>();
            var msg = new MSG();

            mockPreviewHandlerFrame
            .Setup(x => x.TranslateAccelerator(ref msg))
            .Returns(resultCode);

            previewHandlerControl = mockPreviewControl.Object;
            var testPreviewHandler = new TestPreviewHandler();

            testPreviewHandler.SetSite(mockPreviewHandlerFrame.Object);

            // Act
            var actualResultCode = testPreviewHandler.TranslateAccelerator(ref msg);

            // Assert
            Assert.AreEqual(resultCode, actualResultCode);
        }