Exemple #1
0
        public void InputHandlerExample()
        {
            var myMax      = 10;
            var mustBeEven = false;
            var isSuccess  = false;

            var handler = new InputHandler();

            handler.AddOptions((opts) =>
            {
                opts.MaxValue   = myMax;
                opts.MustBeEven = mustBeEven;
                opts.OnSuccess  = new Action(() =>
                {
                    isSuccess = true;
                });
                opts.OnFail = new Action(() =>
                {
                    isSuccess = false;
                });
            });

            handler.Handle(9);
            Assert.True(isSuccess);

            handler.Handle(11);
            Assert.False(isSuccess);
        }