public void Setup() { m_Formatter = Smart.CreateDefaultSmartFormat(); m_GlobalVariablesSource = new GlobalVariablesSource(m_Formatter); m_Formatter.AddExtensions(m_GlobalVariablesSource); m_NestedGroup1 = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_NestedGroup2 = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_Group1 = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_GlobalVariablesSource.Add("global", m_Group1); m_Group1.Add("myInt", new IntGlobalVariable { Value = 123 }); m_Group1.Add("my-Int-var", new IntGlobalVariable()); m_Group1.Add("apple-count", new IntGlobalVariable { Value = 10 }); m_Group1.Add("myFloat", new FloatGlobalVariable { Value = 1.23f }); m_Group1.Add("some-float-value", new FloatGlobalVariable()); m_Group1.Add("time", new FloatGlobalVariable { Value = 1.234f }); m_Group1.Add("door-state", new BoolGlobalVariable { Value = true }); m_Group1.Add("max", new CharacterDetailsNoReflection()); m_Group2 = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_GlobalVariablesSource.Add("npc", m_Group2); m_Group2.Add("emily", new CharacterDetails { FirstName = "Emily", Surname = "Kaldwin", Age = 20, Alive = true }); m_Group2.Add("guy", new CharacterDetails { FirstName = "Guy", Surname = "Threepwood", Alive = false }); // Nested groups m_Group1.Add("nested", new NestedGlobalVariablesGroup { Value = m_NestedGroup1 }); m_NestedGroup1.Add("further-nested", new NestedGlobalVariablesGroup { Value = m_NestedGroup2 }); m_NestedGroup1.Add("nested-float", new FloatGlobalVariable { Value = 0.12345f }); m_NestedGroup2.Add("my-nested-int", new IntGlobalVariable { Value = 1111 }); m_NestedGroup2.Add("my-nested-string", new StringGlobalVariable { Value = "I am nested deep" }); }
public void AddRemovesInvalidCharactersFromName(string expected, string name) { m_Group.Add(name, new IntGlobalVariable()); Assert.False(m_Group.ContainsKey(name), "Expected group to not contain the invalid name"); Assert.True(m_Group.ContainsKey(expected), "Expected group to contain the cleaned up name"); }
public void Setup() { m_Group = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_Group.Add("my-int-variable1", new IntGlobalVariable()); m_Group.Add("my-int-variable2", new IntGlobalVariable()); m_Group.Add("my-int-variable3", new IntGlobalVariable()); m_Group.Add("my-int-variable4", new IntGlobalVariable()); m_Group.Add("my-float-variable1", new FloatGlobalVariable()); m_Group.Add("my-float-variable2", new FloatGlobalVariable()); m_Group.Add("my-float-variable3", new FloatGlobalVariable()); m_Group.Add("my-float-variable4", new FloatGlobalVariable()); m_Group.Add("my-string-variable1", new StringGlobalVariable()); m_Group.Add("my-string-variable2", new StringGlobalVariable()); m_Group.Add("my-bool-variable1", new BoolGlobalVariable()); m_Group.Add("my-bool-variable2", new BoolGlobalVariable()); m_NestedGroup = ScriptableObject.CreateInstance <GlobalVariablesGroup>(); m_Group.Add("nested", new NestedGlobalVariablesGroup { Value = m_NestedGroup }); }