public void TestStateVariables() { EntitySave entitySave = new EntitySave(); entitySave.Name = "CustomVariableTestStateVariableEntity"; ObjectFinder.Self.GlueProject.Entities.Add(entitySave); StateSaveCategory category1 = new StateSaveCategory(); category1.Name = "Category1"; category1.SharesVariablesWithOtherCategories = false; StateSave stateSave = new StateSave(); stateSave.Name = "Disabled"; category1.States.Add(stateSave); StateSaveCategory category2 = new StateSaveCategory(); category2.Name = "Category2"; category2.SharesVariablesWithOtherCategories = false; stateSave = new StateSave(); stateSave.Name = "Disabled"; category2.States.Add(stateSave); entitySave.StateCategoryList.Add(category1); entitySave.StateCategoryList.Add(category2); CustomVariable customVariable = new CustomVariable(); customVariable.Type = "Category2"; customVariable.DefaultValue = "Disabled"; customVariable.Name = "CurrentCategory2State"; entitySave.CustomVariables.Add(customVariable); ElementRuntime elementRuntime = new ElementRuntime(); elementRuntime.Initialize(entitySave, null, null, null, null); StateSave foundStateSave = elementRuntime.GetStateSaveFromCustomVariableValue(customVariable, customVariable.DefaultValue); if (foundStateSave != category2.States[0]) { throw new Exception("States in categories are not being found properly when referenced through custom variables"); } }