public void GetOfflineActivationString_CallsLicenseCheckerHkcu() { var activationHelper = BuildActivationHelper(Product.PdfCreator); activationHelper.GetOfflineActivationString("key"); _licenseCheckerCurrentUser.Received().GetOfflineActivationString("key"); }
public void RenewActivationCommand_WhenExecuted_CallsLicenseChecker() { _editionFactory = BuildValidEditionHelper(); _licenseCheckerActivation = _edition.Activation; var viewModel = BuildViewModel(_editionFactory); viewModel.RenewActivationCommand.Execute(null); viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout); _licenseChecker.Received().ActivateWithoutSavingActivation(ValidLicenseKey); }
public void WithActivationValidForLessThanFourDays_RenewsActivation() { var licenseCondition = BuildCheckLicenseConditions(); _savedActivation.ActivatedTill = DateTime.Now.AddDays(3); _savedActivation.Key = "AAA-BBB-CCC"; licenseCondition.Check(); _licenseChecker.DidNotReceive().GetActivation(); _licenseChecker.Received().ActivateWithKey(_savedActivation.Key); }
public async Task OnlineActivationCommand_CurrentActivationIsNotValid_LicenseCheckerActivationIsValid_SavesActivation() { _savedActivation = null; _expectedLicenseKey = "given-key"; CreateLicenseKeyEnteredInteraction(_expectedLicenseKey); _activationFromServer = BuildValidActivation(_expectedLicenseKey); var viewModel = BuildViewModel(); await viewModel.OnlineActivationAsyncCommand.ExecuteAsync(null); _licenseChecker.Received().SaveActivation(_activationFromServer); Assert.AreEqual(_expectedLicenseKey.ToUpper(), viewModel.LicenseKey); }
public void Run_ActivationNotNull_LicenseCheckerSavesActivationStartupResultIsOk() { var result = _storeLicenseForAllUsersStart.Run(); _licenseChecker.Received().SaveActivation(_activation); Assert.AreEqual(ExitCode.Ok, result); }
public void OnlineActivationCommand_CurrentActivationIsNotValid_LicenseCheckerActivationIsValid_SavesActivation() { _savedActivation = null; _expectedLicenseKey = "given-key"; CreateLicenseKeyEnteredInteraction(_expectedLicenseKey); _activationFromServer = BuildValidActivation(_expectedLicenseKey); var viewModel = BuildViewModel(); viewModel.OnlineActivationCommand.Execute(null); viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout); _licenseChecker.Received().SaveActivation(_activationFromServer); Assert.AreEqual(_expectedLicenseKey.ToUpper(), viewModel.LicenseKey); }
public void WhenQueryingOfflineActivationString_LicenseCheckerIsQueried() { _viewModel.PropertyChanged += ViewModelOnPropertyChanged; _viewModel.LicenseKey = "MY-LICENSE-KEY"; var offlineActivation = _viewModel.OfflineActivationString; _licenseChecker.Received().GetOfflineActivationString(_viewModel.LicenseKey); }
public void OnlineActivationCommand_CurrentActivationIsNotValid_LicenseCheckerActivationIsValid_SavesActivation() { _savedActivation = null; _expectedLicenseKey = "given-key"; _interactionInvoker.When(x => x.Invoke(Arg.Any <InputInteraction>())).Do( x => { ((InputInteraction)x[0]).Success = true; ((InputInteraction)x[0]).InputText = _expectedLicenseKey; }); _activationFromServer = BuildValidActivation(_expectedLicenseKey); var viewModel = BuildViewModel(); viewModel.OnlineActivationCommand.Execute(null); viewModel.LicenseCheckFinishedEvent.WaitOne(_timeout); _licenseChecker.Received().SaveActivation(_activationFromServer); Assert.AreEqual(_expectedLicenseKey.ToUpper(), viewModel.LicenseKey); }
public void WithActivationValidForLessThanFourDays_RenewsAndSavesActivation() { var licenseCondition = BuildCheckLicenseConditions(); _savedActivation.ActivatedTill = DateTime.Now.AddDays(3); _savedActivation.Key = "AAA-BBB-CCC"; _savedActivation.SetResult(Result.OK, "OK"); _licenseChecker.ActivateWithoutSaving(Arg.Any <string>()).Returns(_savedActivation.Some <Activation, LicenseError>()); licenseCondition.Check(); _licenseChecker.DidNotReceive().GetActivation(); _licenseChecker.Received().ActivateWithoutSaving(_savedActivation.Key); _licenseChecker.Received().SaveActivation(_savedActivation); }