Exemple #1
0
        public void Constructor_GivenNullSettings_ShouldThrowError()
        {
            TurtleGameFileSettings settings = null;

            var exception = Record.Exception(() => new FileSequencesRetriever(settings));

            Assert.IsType <ArgumentNullException>(exception);
        }
Exemple #2
0
        public static TurtleGameFileSettings GetFromArguments(string[] args)
        {
            string settingsFileName = args != null && args.Length > 0 ? args[0] : throw new ArgumentException("Game Settings file not specified");
            string movesFileName    = args.Length > 1 ? args[1] : throw new ArgumentException("Moves file not specified");

            Sanitize(settingsFileName, nameof(TurtleGameFileSettings.GameSettingsFile));
            Sanitize(movesFileName, nameof(TurtleGameFileSettings.MovesFile));

            var turtleGameFileSettings = new TurtleGameFileSettings(settingsFileName, movesFileName);

            return(turtleGameFileSettings);
        }
Exemple #3
0
        public FileSequencesRetriever(TurtleGameFileSettings settings)
        {
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));

            Init();
        }