public LicenseCapability GetLicenseCapability() { LicenseCapability lc = new LicenseCapability(); // Set the license capabilities using a bitwise OR to stack the values. lc.SupportedLicenseKeyTypes = LicenseKeyTypeFlag.SingleUser; lc.SupportedLicenseKeyTypes = lc.SupportedLicenseKeyTypes | LicenseKeyTypeFlag.MultiUser; lc.SupportedLicenseKeyTypes = lc.SupportedLicenseKeyTypes | LicenseKeyTypeFlag.Unlimited; lc.SupportedLicenseKeyTypes = lc.SupportedLicenseKeyTypes | LicenseKeyTypeFlag.Enterprise; lc.MaxLicenseKeysPerBatch = 50000; lc.MaxTotalLicenseKeys = 500000; return(lc); }
public void should_allow_only_500000_max_keys() { LicenseCapability lc = smallKeyGenerator.GetLicenseCapability(); Assert.AreEqual(500000, lc.MaxTotalLicenseKeys); }
public void should_allow_only_50000_keys_per_batch() { LicenseCapability lc = smallKeyGenerator.GetLicenseCapability(); Assert.AreEqual(50000, lc.MaxLicenseKeysPerBatch); }
public void should_support_enterprise_type() { LicenseCapability lc = smallKeyGenerator.GetLicenseCapability(); Assert.IsTrue(lc.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Enterprise)); }
public void should_support_unlimited_type() { LicenseCapability lc = smallKeyGenerator.GetLicenseCapability(); Assert.IsTrue(lc.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Unlimited)); }
public void should_support_multi_user_type() { LicenseCapability lc = smallKeyGenerator.GetLicenseCapability(); Assert.IsTrue(lc.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.MultiUser)); }
private void SetLicenseCapibilites() { LicenseCapability capibilities = null; if (cboLicenseKeyType.SelectedValue != null) { switch ((KeyGeneratorTypes)cboLicenseKeyType.SelectedValue) { case KeyGeneratorTypes.StaticSmall: IKeyGenerator keygen = ObjectLocator.GetInstance <IKeyGenerator>(InstanceNames.SmallKeyGenerator); capibilities = keygen.GetLicenseCapability(); chkIsLicenseSetUpgradeOnly.IsChecked = false; chkIsLicenseSetUpgradeOnly.IsEnabled = false; break; case KeyGeneratorTypes.StaticLarge: IKeyGenerator keygenLarge = ObjectLocator.GetInstance <IKeyGenerator>(InstanceNames.LargeKeyGenerator); capibilities = keygenLarge.GetLicenseCapability(); chkIsLicenseSetUpgradeOnly.IsChecked = false; chkIsLicenseSetUpgradeOnly.IsEnabled = true; break; break; case KeyGeneratorTypes.None: capibilities = null; break; default: break; } } if (capibilities != null) { if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.SingleUser)) { chkSingleUser.IsEnabled = true; } else { chkSingleUser.IsChecked = false; chkSingleUser.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.MultiUser)) { chkMultiUser.IsEnabled = true; } else { chkMultiUser.IsChecked = false; chkMultiUser.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.HardwareLock)) { chkHardwareLock.IsEnabled = true; } else { chkHardwareLock.IsChecked = false; chkHardwareLock.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Unlimited)) { chkUnlimited.IsEnabled = true; } else { chkUnlimited.IsChecked = false; chkUnlimited.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Enterprise)) { chkEnterprise.IsEnabled = true; } else { chkEnterprise.IsChecked = false; chkEnterprise.IsEnabled = false; } } else { chkSingleUser.IsChecked = false; chkSingleUser.IsEnabled = false; chkMultiUser.IsChecked = false; chkMultiUser.IsEnabled = false; chkHardwareLock.IsChecked = false; chkHardwareLock.IsEnabled = false; chkUnlimited.IsChecked = false; chkUnlimited.IsEnabled = false; chkEnterprise.IsChecked = false; chkEnterprise.IsEnabled = false; } }
private void SetLicenseCapibilites() { LicenseCapability capibilities = null; if (UIContext.License != null) { switch (UIContext.License.KeyGeneratorType) { case KeyGeneratorTypes.StaticSmall: IKeyGenerator keygen = ObjectLocator.GetInstance <IKeyGenerator>(InstanceNames.SmallKeyGenerator); capibilities = keygen.GetLicenseCapability(); break; default: break; } } if (capibilities != null) { if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.SingleUser)) { cboSingleUser.IsEnabled = true; } else { cboSingleUser.IsChecked = false; cboSingleUser.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.MultiUser)) { cboMultiUser.IsEnabled = true; } else { cboMultiUser.IsChecked = false; cboMultiUser.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.HardwareLock)) { cboHardwareLock.IsEnabled = true; cboHardwareLockLocal.IsEnabled = true; } else { cboHardwareLock.IsChecked = false; cboHardwareLock.IsEnabled = false; cboHardwareLockLocal.IsChecked = false; cboHardwareLockLocal.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Unlimited)) { cboUnlimited.IsEnabled = true; } else { cboUnlimited.IsChecked = false; cboUnlimited.IsEnabled = false; } if (capibilities.SupportedLicenseKeyTypes.IsSet(LicenseKeyTypeFlag.Enterprise)) { cboEnterprise.IsEnabled = true; } else { cboEnterprise.IsChecked = false; cboEnterprise.IsEnabled = false; } } }
public bool Has(LicenseCapability capability) { return(_capabilities.Contains(capability)); }