public void LimitationService_GetNonExistingFeatureLimitation_ReturnsNull() { FeatureLimitationVM limit = service.Get <FeatureLimitationVM> ("Non-existing limitation"); IEnumerable <LimitationVM> allLimitations = service.GetAll(); Assert.AreEqual(0, allLimitations.Count()); Assert.IsNull(limit); }
protected override void CreateViewModel(dynamic data) { ViewModel = new UpgradeLimitationVM(); LimitationVM limitation = (LimitationVM)data.limitationVM; if (data.limitationVM is FeatureLimitationVM) { FeatureLimitationVM featureLimitation = (FeatureLimitationVM)limitation; string featureMessage = (string.IsNullOrEmpty(featureLimitation.DetailInfo)) ? featureLimitation.DisplayName : featureLimitation.DetailInfo; if (!string.IsNullOrEmpty(featureLimitation.DetailInfo)) { ViewModel.Header = featureLimitation.DetailInfo; } else { ViewModel.Header = Catalog.GetString( $"The {featureLimitation.DisplayName} is not available in the {App.Current.LicenseManager.LicenseStatus.PlanName} plan"); } } else if (limitation is CountLimitationVM) { ViewModel.Header = Catalog.GetString( $"You have reached the limit of {limitation.DisplayName} available for your plan"); } else { ViewModel.Header = Catalog.GetString("Unlock your team's potential with LongoMatch PRO"); } if (limitation != null) { ViewModel.FeaturesHeader = Catalog.GetString("Upgrade to LongoMatch PRO and unlock your team's potential"); } else { ViewModel.FeaturesHeader = Catalog.GetString("Upgrade to get access to the following features"); } ViewModel.Features = new RangeObservableCollection <string> { Catalog.GetString("Unlimited projects, dashboards and teams"), Catalog.GetString("4x Zoom-in factor"), Catalog.GetString("Multicamera Analysis"), Catalog.GetString("SportsCode & XML Import and Export") }; ViewModel.FeaturesCaption = Catalog.GetString("... and much more"); ViewModel.UpgradeCommand = new Command(() => { App.Current.NetworkManager.OpenURL(LMConstants.UPGRADE_URL, $"Limitation_{limitation.RegisterName.Replace (" ", string.Empty)}"); App.Current.EventsBroker.Publish(new UpgradeLinkClickedEvent { LimitationName = limitation.RegisterName, Source = "UpgradeDialog" }); }); ViewModel.UpgradeCommand.Text = Catalog.GetString("UPGRADE TO PRO"); ViewModel.Undecided = Catalog.GetString("Still undecided?"); ViewModel.OtherPlansURL = LMConstants.OTHER_PLANS_URL; }
/// <summary> /// Add the specified feature limitation and command. /// </summary> /// <param name="limitation">Limitation.</param> /// <param name="command">Limitation Command.</param> public void Add(FeatureLicenseLimitation limitation) { if (Limitations.ContainsKey(limitation.RegisterName)) { throw new InvalidOperationException("Limitations cannot be overwritten"); } FeatureLimitationVM viewModel = new FeatureLimitationVM { Model = limitation }; Limitations [limitation.RegisterName] = viewModel; }
public void LimitationService_AddFeatureLimitations() { service.Add(limitationFeature); service.Add(limitationFeatureDisabled); FeatureLimitationVM testLimitationFeature1 = service.Get <FeatureLimitationVM> ("Feature 1"); FeatureLimitationVM testLimitationFeature2 = service.Get <FeatureLimitationVM> ("Feature 2"); IEnumerable <LimitationVM> allLimitations = service.GetAll(); Assert.AreEqual(2, allLimitations.Count()); Assert.IsTrue(testLimitationFeature1.Enabled); Assert.AreEqual(limitationFeature.RegisterName, testLimitationFeature1.RegisterName); Assert.IsFalse(testLimitationFeature2.Enabled); Assert.AreEqual(limitationFeatureDisabled.RegisterName, testLimitationFeature2.RegisterName); }