//public void GetData(Action<AppSecret, Exception> callback) //{ // // Use this to create design time data // var item = new AppSecret(); // callback(item, null); //} public void GetAllSecrets(Action <IList <IApiSecret>, Exception> callback) { callback(new List <IApiSecret>() { new ApiSecret() { AllowedApis = new List <ApiType>() { ApiType.ComputerApi, ApiType.Telefoni }, Description = "Testing description", Owner = "sf9398", Secret = SecretGenerator.RandomString(15) }, new ApiSecret() { AllowedApis = new List <ApiType>() { ApiType.ComputerApi, ApiType.Telefoni }, Description = "Testing description", Owner = "sf9398", Secret = SecretGenerator.RandomString(15) }, new ApiSecret() { AllowedApis = new List <ApiType>() { ApiType.ComputerApi, ApiType.Telefoni }, Description = "Testing description", Owner = "sf9398", Secret = SecretGenerator.RandomString(15) } }, null); }
public void Secret_Length_Test() { var secret = SecretGenerator.RandomString(15); Assert.IsNotNull(secret, "Secret is null after gbeeing generated"); Assert.AreEqual(15, secret.Length, "Secret is not the length spesified in generation"); }
public void Secret_Uniqe_Test() { var numberOfGenerations = 1000; var range = Enumerable.Range(0, numberOfGenerations); var secrets = range.Select(i => SecretGenerator.RandomString(15)); var duplicats = secrets.Distinct(); Assert.AreEqual(numberOfGenerations, duplicats.Count()); }
public void Secret_Negative_Length_Test() { Assert.Throws <ArgumentOutOfRangeException>(() => SecretGenerator.RandomString(-15)); }