public void WhenExecuteWithNoParameters_ThenDisplaysError() { provider.Execute((new GuidanceShortcut(new Mock <IShortcut>().Object))); this.guidanceProvider.Verify(gp => gp.CreateInstance(It.IsAny <string>(), It.IsAny <string>()), Times.Never()); this.guidanceProvider.Verify(gp => gp.ActivateInstance(It.IsAny <string>()), Times.Never()); this.messageService.Verify(ums => ums.ShowError(Resources.GuidanceShortcutProvider_InvalidParameters), Times.Once()); }
public void WhenExecuteWithForcedRegisteredExistingDefaultInstance_ThenCreatesNewUniqueDefaultNamedInstance() { this.parameters.Add(GuidanceShortcut.AlwaysCreateParameterName, "true"); this.guidanceProvider.Setup(gp => gp.GetDefaultInstanceName("foo")).Returns("default"); this.guidanceProvider.Setup(gp => gp.IsRegistered("foo")).Returns(true); this.guidanceProvider.Setup(gp => gp.InstanceExists("foo", "default")).Returns(true); this.guidanceProvider.Setup(gp => gp.GetUniqueInstanceName("default")).Returns("default1"); provider.Execute((new GuidanceShortcut(shortcut.Object))); this.guidanceProvider.Verify(gp => gp.ActivateInstance(It.IsAny <string>()), Times.Never()); this.guidanceProvider.Verify(gp => gp.CreateInstance("foo", "default1"), Times.Once()); this.messageService.Verify(ums => ums.ShowError(It.IsAny <string>()), Times.Never()); }