void when_creating_config() { it["creates config from EntitasPreferencesConfig"] = () => { var config = new VisualDebuggingConfig(new Config(configString)); config.systemWarningThreshold.should_be("12"); config.defaultInstanceCreatorFolderPath.should_be("path/to/folder/"); config.typeDrawerFolderPath.should_be("path/to/otherFolder/"); }; it["gets default values when keys dont exist"] = () => { var config = new VisualDebuggingConfig(new Config(string.Empty)); config.systemWarningThreshold.should_be("8"); config.defaultInstanceCreatorFolderPath.should_be("Assets/Editor/DefaultInstanceCreator/"); config.typeDrawerFolderPath.should_be("Assets/Editor/TypeDrawer/"); }; it["sets values"] = () => { var config = new VisualDebuggingConfig(new Config(configString)); config.systemWarningThreshold = "6"; config.defaultInstanceCreatorFolderPath = "new/path/"; config.typeDrawerFolderPath = "new/otherPath/"; config.systemWarningThreshold.should_be("6"); config.defaultInstanceCreatorFolderPath.should_be("new/path/"); config.typeDrawerFolderPath.should_be("new/otherPath/"); }; it["gets string"] = () => { var config = new VisualDebuggingConfig(new Config(configString)); config.systemWarningThreshold = "6"; config.defaultInstanceCreatorFolderPath = "new/path/"; config.typeDrawerFolderPath = "new/otherPath/"; config.ToString().should_be( "Entitas.VisualDebugging.Unity.SystemWarningThreshold = 6\n" + "Entitas.VisualDebugging.Unity.DefaultInstanceCreatorFolderPath = new/path/\n" + "Entitas.VisualDebugging.Unity.TypeDrawerFolderPath = new/otherPath/\n"); }; it["gets string from empty config"] = () => { var config = new VisualDebuggingConfig(new Config(string.Empty)); config.ToString().should_be( "Entitas.VisualDebugging.Unity.SystemWarningThreshold = 8\n" + "Entitas.VisualDebugging.Unity.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/\n" + "Entitas.VisualDebugging.Unity.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/\n"); }; it["has all keys"] = () => { var keys = VisualDebuggingConfig.keys; keys.should_contain("Entitas.VisualDebugging.Unity.SystemWarningThreshold"); keys.should_contain("Entitas.VisualDebugging.Unity.DefaultInstanceCreatorFolderPath"); keys.should_contain("Entitas.VisualDebugging.Unity.TypeDrawerFolderPath"); }; }
void when_creating_config() { VisualDebuggingConfig config = null; before = () => { config = new VisualDebuggingConfig(); }; context["when input string"] = () => { before = () => { config.Configure(new Properties(configString)); }; it["creates config"] = () => { config.systemWarningThreshold.should_be(12); config.defaultInstanceCreatorFolderPath.should_be("dicPath"); config.typeDrawerFolderPath.should_be("tdPath"); }; context["when setting values"] = () => { before = () => { config.systemWarningThreshold = 6; config.defaultInstanceCreatorFolderPath = "newDicPath"; config.typeDrawerFolderPath = "newTdPath"; }; it["sets values"] = () => { config.systemWarningThreshold.should_be(6); config.defaultInstanceCreatorFolderPath.should_be("newDicPath"); config.typeDrawerFolderPath.should_be("newTdPath"); }; it["gets string"] = () => { config.ToString().should_be( "Entitas.VisualDebugging.Unity.Editor.SystemWarningThreshold = 6\n" + "Entitas.VisualDebugging.Unity.Editor.DefaultInstanceCreatorFolderPath = newDicPath\n" + "Entitas.VisualDebugging.Unity.Editor.TypeDrawerFolderPath = newTdPath\n"); }; }; }; }
void when_creating_config() { it["creates config from EntitasPreferencesConfig"] = () => { var config = new VisualDebuggingConfig(new EntitasPreferencesConfig(configString)); config.defaultInstanceCreatorFolderPath.should_be("path/to/folder/"); config.typeDrawerFolderPath.should_be("path/to/otherFolder/"); }; it["gets default values when keys dont exist"] = () => { var config = new VisualDebuggingConfig(new EntitasPreferencesConfig(string.Empty)); config.defaultInstanceCreatorFolderPath.should_be("Assets/Editor/DefaultInstanceCreator/"); config.typeDrawerFolderPath.should_be("Assets/Editor/TypeDrawer/"); }; it["sets values"] = () => { var config = new VisualDebuggingConfig(new EntitasPreferencesConfig(configString)); config.defaultInstanceCreatorFolderPath = "new/path/"; config.typeDrawerFolderPath = "new/otherPath/"; config.defaultInstanceCreatorFolderPath.should_be("new/path/"); config.typeDrawerFolderPath.should_be("new/otherPath/"); }; it["gets string"] = () => { var config = new VisualDebuggingConfig(new EntitasPreferencesConfig(configString)); config.defaultInstanceCreatorFolderPath = "new/path/"; config.typeDrawerFolderPath = "new/otherPath/"; config.ToString().should_be( "Entitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = new/path/\n" + "Entitas.Unity.VisualDebugging.TypeDrawerFolderPath = new/otherPath/\n"); }; it["gets string from empty config"] = () => { var config = new VisualDebuggingConfig(new EntitasPreferencesConfig(string.Empty)); config.ToString().should_be( "Entitas.Unity.VisualDebugging.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator/\n" + "Entitas.Unity.VisualDebugging.TypeDrawerFolderPath = Assets/Editor/TypeDrawer/\n"); }; }