public void OnlineActivationCommand_CurrentEditionIsNotValid_LicenseCheckerActivationIsNotValid_UpdateEditionWithGivenKeyDoNotSaveNewEditionAndInformUser() { _activationHelper.Activation.Returns(new Activation()); _expectedLicenseKey = "given-key"; _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do( x => { ((InputInteraction)x[0]).Success = true; ((InputInteraction)x[0]).InputText = _expectedLicenseKey; }); var messageInteraction = new MessageInteraction("", "", MessageOptions.OKCancel, MessageIcon.None); _interactionInvoker.When(x => x.Invoke(Arg.Any <MessageInteraction>())).Do( x => messageInteraction = x.Arg <MessageInteraction>()); _activationHelper.LicenseStatus.Returns(LicenseStatus.Error); var viewModel = BuildViewModel(); var propertyChangedEvents = new List <string>(); viewModel.PropertyChanged += (sender, args) => propertyChangedEvents.Add(args.PropertyName); viewModel.OnlineActivationCommand.Execute(null); viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout); _activationHelper.DidNotReceive().SaveActivation(); Assert.AreEqual(_expectedLicenseKey.Replace("-", ""), viewModel.Activation.Key, "Given key not set in updated license"); Assert.AreEqual(ActivationFailedString, messageInteraction.Title); Assert.AreEqual(MessageOptions.OK, messageInteraction.Buttons); Assert.AreEqual(MessageIcon.Error, messageInteraction.Icon); }
public void WithActivationValidForMoreThanFourDays_DoesNotRenew() { var licenseCondition = BuildCheckLicenseConditions(); _activationHelper.LicenseStatus.Returns(LicenseStatus.Valid); _activationHelper.Activation.ActivatedTill = DateTime.Now.AddDays(4).AddMinutes(5); licenseCondition.Check(); _activationHelper.DidNotReceive().RenewActivation(); }