public void CachingVersion()
        {
            var typeName = "System.String";

            Assert.AreEqual(
                _sut.IsEnabled(typeName),
                RandomizedModelEnabler.IsEnabledForUserAndType(
                    _userProfileSettings.ProfileId,
                    typeName,
                    RandomizedModelEnabler.AvailabilityChance));
        }
        public void ResultIsDeterministic()
        {
            var profileId   = Guid.NewGuid().ToString();
            var typeName    = Guid.NewGuid().ToString();
            var firstResult = RandomizedModelEnabler.IsEnabledForUserAndType(profileId, typeName, 50);

            for (int i = 0; i < 100; i++)
            {
                var repeatedResult = RandomizedModelEnabler.IsEnabledForUserAndType(profileId, typeName, 50);
                Assert.AreEqual(firstResult, repeatedResult);
            }
        }
        private static int CountEnabled(int reps, string type)
        {
            var numEnabled = 0;

            for (var i = 0; i < reps; i++)
            {
                var profileId = "pid" + i;

                if (RandomizedModelEnabler.IsEnabledForUserAndType(profileId, type, 50))
                {
                    numEnabled++;
                }
            }
            return(numEnabled);
        }
 public void NoneAvailableWith0PercentProbability(string profileId, string typeName)
 {
     Assert.IsFalse(RandomizedModelEnabler.IsEnabledForUserAndType(profileId, typeName, 0));
 }
 public void AllAvailableWith100PercentProbability(string profileId, string typeName)
 {
     Assert.IsTrue(RandomizedModelEnabler.IsEnabledForUserAndType(profileId, typeName, 100));
 }