public void ValidatesToTrue()
        {
            var input = "Einheit";
            var vocab = new Vocab {
                Soruce = "Unit", Target = "Einheit"
            };
            var validator = new StrictAnswerValidator();
            var result    = validator.Validate(vocab, input);

            Assert.True(result);
        }
        public void IsCaseSensetive()
        {
            var input = "ABC";
            var vocab = new Vocab {
                Soruce = "Unit", Target = input
            };
            var validator = new StrictAnswerValidator();
            var result    = validator.Validate(vocab, input.ToLower());

            Assert.False(result);
        }
        public void CanHandleSpacesAndSpecialChars()
        {
            var input = "/ _!#-$%&/{=";
            var vocab = new Vocab {
                Soruce = "Unit", Target = input
            };
            var validator = new StrictAnswerValidator();
            var result    = validator.Validate(vocab, input);

            Assert.True(result);
        }
        public void CanHandleUTF8()
        {
            var input = "öüä";
            var vocab = new Vocab {
                Soruce = "Unit", Target = input
            };
            var validator = new StrictAnswerValidator();
            var result    = validator.Validate(vocab, input);

            Assert.True(result);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var validator     = new StrictAnswerValidator();
            var parser        = new FileIniDataParserExtension(new FileIniDataParser());
            var vocabProvider = new IniFileVocabDataProvider(parser);
            var ui            = new ConsoleUserInterface();

            ui.Start();
            var settingsIndex = ui.GetSettingsIndex();
            var settings      = ExamSettingsFactory.Build((ExamSettingsFactory.SettingTypes)settingsIndex);
            var iterator      = new Iterator(settings, vocabProvider);
            var calculator    = new Calculator(iterator.Count());
            var handler       = new Handler(ui, settings, iterator, calculator, validator);

            handler.Run();
            ui.Quit(calculator);
        }
Exemplo n.º 6
0
 public Handler(IUserInterface ui, ISettings settings, Iterator iterator, Calculator calculator, StrictAnswerValidator validator)
 {
     _ui         = ui;
     _settings   = settings;
     _iterator   = iterator;
     _calculator = calculator;
     _validator  = validator;
 }