Exemple #1
0
            public void WhenFileHandlerThrowsShortcutFormatException_ThenDisplaysErrorAndReturnsFalse()
            {
                this.fileHandler.Setup(fh => fh.ReadShortcut()).Throws <ShortcutFileFormatException>();

                var result = ShortcutLaunchCoordinator.LaunchShortcut(this.serviceProvider.Object, fileHandler.Object);

                this.msgService.Verify(ms => ms.ShowError(It.IsAny <string>()), Times.Once());
                Assert.False(result);
            }
Exemple #2
0
            public void WhenProviderNotRegistered_ThenDisplaysErrorAndReturnsFalse()
            {
                this.fileHandler.Setup(fh => fh.ReadShortcut()).Returns(Mock.Of <IShortcut>());
                this.launchService.Setup(ls => ls.IsTypeRegistered(It.IsAny <string>())).Returns(false);

                var result = ShortcutLaunchCoordinator.LaunchShortcut(this.serviceProvider.Object, fileHandler.Object);

                this.msgService.Verify(ms => ms.ShowError(It.IsAny <string>()), Times.Once());
                Assert.False(result);
            }
Exemple #3
0
            public void WhenShortcutResolvedAndNotUpdated_ThenReturnsTrue()
            {
                this.fileHandler.Setup(fh => fh.ReadShortcut()).Returns(Mock.Of <IShortcut>());
                this.launchService.Setup(ls => ls.IsTypeRegistered(It.IsAny <string>())).Returns(true);
                this.launchService.Setup(ls => ls.ResolveShortcut(It.IsAny <IShortcut>())).Returns(Mock.Of <IShortcut>());
                this.launchService.Setup(ls => ls.Execute(It.IsAny <IShortcut>(), null)).Returns((IShortcut)null);

                var result = ShortcutLaunchCoordinator.LaunchShortcut(this.serviceProvider.Object, fileHandler.Object);

                fileHandler.Verify(ms => ms.WriteShortcut(It.IsAny <IShortcut>()), Times.Never());
                Assert.True(result);
            }