public void StoreLicenseInLmCommandExecute_StoreLicenseForAllUsersFailed_ShowMessageWindow() { _uacAssistant.StoreLicenseForAllUsers(Arg.Any <string>(), Arg.Any <string>()).Returns(false); var title = ""; var text = ""; var options = MessageOptions.MoreInfoCancel; var icon = MessageIcon.None; var translation = new StoreLicenseForAllUsersWindowTranslation(); _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do(x => { var interaction = x[0] as MessageInteraction; title = interaction.Title; text = interaction.Text; options = interaction.Buttons; icon = interaction.Icon; }); _storeLicenseForAllUsersWindowViewModel.StoreLicenseInLmCommand.Execute(null); Assert.AreEqual(ProductName, title, "Title of message box is not the product name"); Assert.AreEqual(translation.StoreForAllUsersFailed, text, "Wrong text in message box"); Assert.AreEqual(MessageOptions.OK, options, "Wrong options in message box"); Assert.AreEqual(icon, MessageIcon.Error, "Wrong MessageBoxIcon"); }
public StoreLicenseForAllUsersWindowViewModel(ApplicationNameProvider applicationNameProvider, IOsHelper osHelper, IUacAssistant uacAssistant, IInteractionInvoker interactionInvoker, StoreLicenseForAllUsersWindowTranslation translation) { _osHelper = osHelper; _uacAssistant = uacAssistant; _interactionInvoker = interactionInvoker; Translation = translation; ProductName = applicationNameProvider.ApplicationName; StoreLicenseInLmCommand = new DelegateCommand(StoreLicenseInLmCommandExecute); }
public void StoreLicenseInLmCommandExecute_StoreLicenseForAllUsersFailed_ShowMessageWindow() { _uacAssistant.StoreLicenseForAllUsers(Arg.Any <string>(), Arg.Any <string>()).Returns(false); var translation = new StoreLicenseForAllUsersWindowTranslation(); _storeLicenseForAllUsersWindowViewModel.StoreLicenseInLmCommand.Execute(null); var interaction = _interactionRequest.AssertWasRaised <MessageInteraction>(); Assert.AreEqual(ApplicationNameWithEdition.ToUpper(), interaction.Title, "Title of message box is not the product name"); Assert.AreEqual(translation.StoreForAllUsersFailed, interaction.Text, "Wrong text in message box"); Assert.AreEqual(MessageOptions.OK, interaction.Buttons, "Wrong options in message box"); Assert.AreEqual(MessageIcon.Error, interaction.Icon, "Wrong MessageBoxIcon"); }