Esempio n. 1
0
        static void Main(string[] args)
        {
            GameSettings settings;

            try {
                settings = GameSettingsConstructor.LoadSettings(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data", "GameSettingsConfig.json"));
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                return;
            }

            var input    = settings.Input;
            var output   = settings.Output;
            var levelSet = settings.LevelSet;
            var lives    = settings.Lives;

            output.WriteMenu();

            var engine = new Engine(levelSet[0], input, output, new GameTimer());
            var game   = new Game(lives, engine, levelSet, output);

            game.StartGame();
        }
Esempio n. 2
0
 public void AttemptingToBuildAnInvalidSettingsObjectThrowsException(string path)
 {
     Assert.Throws <InvalidSettingsConfigurationException>(() =>
                                                           GameSettingsConstructor.LoadSettings(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestData",
                                                                                                             path)));
 }
Esempio n. 3
0
        public void CanCreateValidSettingsObjectFromValidData()
        {
            var settings = GameSettingsConstructor.LoadSettings(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestData", "SuccessfulConfig.json"));

            Assert.Equal(3, settings.Lives);
        }