public void SaveConfig_savesWholeThingAndReturnsId()
    {
        var config = DefaultEvolutionConfig;

        config.DatabaseId = -13; //set id to something really obvious to show if it hasn't been set correctly.

        int result = _handler.SaveNewEvolutionConfig(config);

        var expectedId = 4;

        Assert.AreEqual(expectedId, result);

        var retrieved = _handler.ReadConfig(expectedId);

        Assert.AreEqual(expectedId, retrieved.DatabaseId);
        Assert.AreEqual("SaveConfigTest", retrieved.RunName);
        Assert.AreEqual(3, retrieved.BrConfig.NumberOfCombatants);
        Assert.AreEqual(43, retrieved.MatchConfig.MinimumLocationRandomisation);
        Assert.AreEqual(44, retrieved.MatchConfig.MaximumLocationRandomisation);
        Assert.AreEqual(123, retrieved.BrConfig.DeathScoreMultiplier);
        Assert.AreEqual(2342, retrieved.RaceConfig.RaceMaxDistance);
        Assert.AreEqual(1234, retrieved.RaceConfig.RaceScoreMultiplier);
        Assert.AreEqual(432, retrieved.BrConfig.SurvivalBonus);
        Assert.AreEqual(4, retrieved.RaceConfig.RaceGoalObject);
    }
Ejemplo n.º 2
0
    public void SaveConfig_savesWholeThingAndReturnsId()
    {
        var config = DefaultEvolutionConfig;

        config.MatchConfig.MinimumLocationRandomisation        = 91;
        config.MatchConfig.MaximumLocationRandomisation        = 92;
        config.EvolutionDroneConfig.DronesInSphereRandomRadius = 93;
        config.EvolutionDroneConfig.DronesOnSphereRandomRadius = 94;

        config.DatabaseId = -13; //set id to something really obvious to show if it hasn't been set correctly.

        int result = _handler.SaveNewEvolutionConfig(config);

        var expectedId = 4;

        Assert.AreEqual(expectedId, result);

        var retrieved = _handler.ReadConfig(expectedId);

        Assert.AreEqual(expectedId, retrieved.DatabaseId);
        Assert.AreEqual("SaveConfigTest", retrieved.RunName);
        Assert.AreEqual(91, retrieved.MatchConfig.MinimumLocationRandomisation);
        Assert.AreEqual(92, retrieved.MatchConfig.MaximumLocationRandomisation);
        Assert.AreEqual(93, retrieved.EvolutionDroneConfig.DronesInSphereRandomRadius);
        Assert.AreEqual(94, retrieved.EvolutionDroneConfig.DronesOnSphereRandomRadius);

        Assert.AreEqual(config.MatchConfig.Budget, retrieved.MatchConfig.Budget);
    }
Ejemplo n.º 3
0
        protected int SaveConfig()
        {
            var config = ReadControls();

            if (_hasLoadedExisting)
            {
                return(_handler.UpdateExistingEvolutionConfig(config));
            }
            else
            {
                return(_handler.SaveNewEvolutionConfig(config));
            }
        }