コード例 #1
0
        public void It_Should_Create_A_SimulationConfiguration_Given_A_Valid_Config_file()
        {
            var expected   = new SimulationConfiguration(100, 250, GridType.Glider, RuleSetType.Standard, 5, 5);
            var jsonLoader = new JsonConfigurationLoader(ValidFile);

            var actual = jsonLoader.Load();

            Assert.AreEqual(JsonConvert.SerializeObject(expected), JsonConvert.SerializeObject(actual));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var configLoader = new JsonConfigurationLoader(ConfigFileName);

            var simulationConfig = configLoader.Load();
            var simulation       = new Simulation(simulationConfig, new CommandLinePresenter(new Writer()), new Timer());

            simulation.Execute();
        }
コード例 #3
0
        public void It_Should_Throw_An_InvalidSimulationConfigurationException_Given_Invalid_Config_Files(string path)
        {
            var jsonLoader = new JsonConfigurationLoader(path);

            void LoadConfiguration()
            {
                jsonLoader.Load();
            }

            Assert.Throws(Is.TypeOf <InvalidSimulationConfigurationException>(), LoadConfiguration);
        }
コード例 #4
0
        public void It_Should_Throw_A_FileNotFoundException_Given_A_Config_That_Doesnt_Exist()
        {
            var jsonLoader = new JsonConfigurationLoader(NonexistentFile);

            void LoadConfiguration()
            {
                jsonLoader.Load();
            }

            Assert.Throws(Is.TypeOf <FileNotFoundException>(), LoadConfiguration);
        }