Exemplo n.º 1
0
        public void SendRequestToWebAPI3Test()
        {
            var keydata = new ExtendLicenseModel()
            {
                Key = "ITVBC-GXXNU-GSMTK-NIJBT", NoOfDays = 30, ProductId = 3349
            };

            string tkn = "WyI0IiwiY0E3aHZCci9FWFZtOWJYNVJ5eTFQYk8rOXJSNFZ5TTh1R25YaDVFUiJd";

            var ans = HelperMethods.SendRequestToWebAPI3 <BasicResult>(keydata, "/key/extendlicense/", tkn);

            Assert.AreEqual(ans.Result, ResultType.Success);
        }
Exemplo n.º 2
0
        public void ExtendLicenseTest()
        {
            var keydata = new ExtendLicenseModel()
            {
                Key = "ITVBC-GXXNU-GSMTK-NIJBT", NoOfDays = 30, ProductId = 3349
            };
            var auth = "WyI0IiwiY0E3aHZCci9FWFZtOWJYNVJ5eTFQYk8rOXJSNFZ5TTh1R25YaDVFUiJd";

            var result = Key.ExtendLicense(auth, keydata);

            if (result != null && result.Result == ResultType.Success)
            {
                // the license was successfully extended with 30 days.
            }
            else
            {
                Assert.Fail();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// This method will extend a license by a certain amount of days.
 /// If the key algorithm in the product is SKGL, the key string
 /// will be changed if necessary. Otherwise, if SKM15 is used,
 /// the key will stay the same.
 /// If the key is changed, the new key will be stored in the message.
 /// </summary>
 /// <param name="token">Details such as Token and Version.</param>
 /// <param name="parameters">The parameters that the method needs.</param>
 /// <example>
 /// Here is an example that demonstrates the use of the method.
 /// <code language="cs" title="C#">
 /// var keydata = new ExtendLicenseModel() { Key = "ITVBC-GXXNU-GSMTK-NIJBT", NoOfDays = 30, ProductId = 3349 };
 /// var auth = "WyI0IiwiY0E3aHZCci9FWFZtOWJYNVJ5eTFQYk8rOXJSNFZ5TTh1R25YaDVFUiJd";
 ///
 /// var result = Key.ExtendLicense(auth, keydata);
 ///
 /// if (result != null && result.Result == ResultType.Success)
 /// {
 ///
 ///     // the license was successfully extended with 30 days.
 /// }
 /// else
 /// {
 ///     Assert.Fail();
 /// }
 /// </code>
 /// </example>
 /// <remarks>This method may, in rare cases, return null if an error has occurred.
 /// Null should be seen as an unsuccessful result.
 /// </remarks>
 /// <returns>A BasicResult object or null.</returns>
 public static BasicResult ExtendLicense(string token, ExtendLicenseModel parameters)
 {
     return(HelperMethods.SendRequestToWebAPI3 <BasicResult>(parameters, "/key/extendlicense/", token));
 }