public void AddFeatureTest() { var keydata = new FeatureModel() { Key = "LXWVI-HSJDU-CADTC-BAJGW", Feature = 2, ProductId = 3349 }; var auth = "WyI2Iiwib3lFQjFGYk5pTHYrelhIK2pveWdReDdEMXd4ZDlQUFB3aGpCdTRxZiJd"; var result = Key.AddFeature(auth, keydata); if (result != null && result.Result == ResultType.Success) { // feature 2 is set to true. } else { Assert.Fail(); } }
static void AddFeature() { var keydata = new FeatureModel() { Key = "LXWVI-HSJDU-CADTC-BAJGW", Feature = 2, ProductId = 3349 }; var auth = "WyI2Iiwib3lFQjFGYk5pTHYrelhIK2pveWdReDdEMXd4ZDlQUFB3aGpCdTRxZiJd"; var result = Key.AddFeature(auth, keydata); if (result != null && result.Result == ResultType.Success) { // feature 2 is set to true. Console.WriteLine("Feature 2 set to true"); } else { Console.WriteLine("Feature 2 was not changed because of an error: " + result.Message); } }
public void KeyLockTest() { // make sure the access token below has key lock set to "-1". // the token below has key lock set to "-1" and access to "AddFeature" method. // note, we cannot use this token for anything but the Key Lock method, in order // to get a new token. var auth = "WyI0NCIsInRhOGNJZm1BS0xkbGJjUW55UkdEN3lzTzhWckd6SzRzYlgvRkFOQmQiXQ=="; // 1. Get a new token var key = "ITVBC-GXXNU-GSMTK-NIJBT"; var result = Auth.KeyLock(auth, new KeyLockModel { Key = key, ProductId = 3349 }); var newAuth = result.Token; // 2. Access the method var addFeature = Key.AddFeature(newAuth, new FeatureModel { Feature = 2, ProductId = 3349, Key = key }); // this should work if (addFeature.Result == ResultType.Error) { Assert.Fail(); } var wrongKey = "MTMPW-VZERP-JZVNZ-SCPZM"; var addFeatureWrongKey = Key.AddFeature(newAuth, new FeatureModel { Feature = 2, ProductId = 3, Key = wrongKey }); // this should not work if (addFeatureWrongKey != null && addFeatureWrongKey.Result == ResultType.Success) { Assert.Fail(); } }