Пример #1
0
        static void Main(string[] args)
        {
            var model = LoadFromFile("./model.xml");
            var toggle = new Toggle(new Hasher());
            var count = 0;

            try
            {
                foreach (var identifer in model.Identifiers)
                {
                    var willSeeFeature = toggle.IsFeatureOn(model.Config, identifer);
                    Console.WriteLine("{0} for {1}", willSeeFeature ? "True " : "False", identifer);
                    if (willSeeFeature) count++;
                }

                Console.WriteLine();
                Console.WriteLine("{0} of {1} users ({2}) will see the feature", count, model.Identifiers.Count, (count/(double) model.Identifiers.Count).ToString("P"));
                Console.WriteLine("Using config: {0}", model.Config);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Пример #2
0
        public void Setup()
        {
            identifier = "test-user";
            mockHasher = new Mock<IHasher>();

            ClassUnderTest = new Toggle(mockHasher.Object);
        }