public void Constructor_GivenNullSettings_ShouldThrowError() { TurtleGameFileSettings settings = null; var exception = Record.Exception(() => new FileSequencesRetriever(settings)); Assert.IsType <ArgumentNullException>(exception); }
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); }
public FileSequencesRetriever(TurtleGameFileSettings settings) { _settings = settings ?? throw new ArgumentNullException(nameof(settings)); Init(); }