Пример #1
0
        // Use this for initialization
        void Start()
        {
            _handler.InitialiseConnection();
            LoadConfigFromDB();

            RunButton.onClick.AddListener(delegate() { SaveAndRun(); });
            CopyButton.onClick.AddListener(delegate() { SaveNewAndRun(); });
            CancelButton.onClick.AddListener(delegate() { ReturnToMainMenu(); });

            DeleteButton.onClick.AddListener(delegate() {
                if (ArgumentStore.IdToLoad.HasValue)
                {
                    _handler.DeleteConfig(ArgumentStore.IdToLoad.Value);
                    ReturnToMainMenu();
                }
                else
                {
                    Debug.Log("Cannot delete config because there is none loaded.");
                }
            });

            ResetButton.onClick.AddListener(delegate() {
                if (ArgumentStore.IdToLoad.HasValue)
                {
                    _handler.DeleteIndividuals(ArgumentStore.IdToLoad.Value);
                    SaveAndRun();
                }
                else
                {
                    Debug.Log("Cannot delete config because there is none loaded.");
                }
            });
        }
Пример #2
0
    public void DeleteIndividuals_DeletesIndividualsForConfigWithGivenID()
    {
        var id      = 2;
        var configs = _handler.ListConfigs();

        Assert.IsTrue(configs.Any(c => c.Key == id));

        var generationBefore = _handler.ReadGeneration(id, 0);

        Assert.AreEqual(2, generationBefore.Individuals.Count);

        _handler.DeleteIndividuals(id);

        var configsAfter = _handler.ListConfigs();

        Assert.IsTrue(configsAfter.Any(c => c.Key == id));

        var generationAfter = _handler.ReadGeneration(id, 0);

        Assert.AreEqual(0, generationAfter.Individuals.Count);
    }