public void Initialize() { this.automation = new Mock<IAutomationExtension>(); this.status = this.automation.As<ICommandStatus>(); this.menu = automation.As<IAutomationMenuCommand>(); this.menu.Setup(m => m.Text).Returns("Foo"); this.target = new AutomationMenuOptionViewModel(this.automation.Object); }
public void WhenAutomationNotImplementingStatus_ThenCanExecuteIsStillTrue() { var automation = new Mock<IAutomationExtension>(); var menu = automation.As<IAutomationMenuCommand>(); menu.Setup(m => m.Text).Returns("Foo"); menu.Setup(x => x.Enabled).Returns(true); this.target = new AutomationMenuOptionViewModel(automation.Object); Assert.True(this.target.Command.CanExecute(null)); }
public void WhenImageNotPresent_ThenImageIsSetAndTypeIsNone() { var automation = new Mock<IAutomationExtension>(); var menu = automation.As<IAutomationMenuCommand>(); menu.Setup(m => m.Text).Returns("Foo"); menu.Setup(a => a.IconPath).Returns<string>(null); var viewModel = new AutomationMenuOptionViewModel(automation.Object); Assert.Equal(IconType.None, viewModel.IconType); Assert.Null(viewModel.ImagePath); }
public void WhenImagePresent_ThenImageIsSetAndTypeIsImage() { var automation = new Mock<IAutomationExtension>(); var menu = automation.As<IAutomationMenuCommand>(); menu.Setup(m => m.Text).Returns("Foo"); menu.Setup(a => a.IconPath).Returns("pack://application,,,/Assembly;component/path/ico.ico"); var viewModel = new AutomationMenuOptionViewModel(automation.Object); Assert.Equal(IconType.Image, viewModel.IconType); Assert.NotNull(viewModel.ImagePath); }