public void AddOrUpdateVariableToGroupType_AddsVariable()
        {
            ProfileGroupType profileGroupType = new ProfileGroupType("TestPrefix");
            var bp = profileGroupType.GetVariableBySuffix("TestSuffix");

            Assert.IsNull(bp);

            profileGroupType.AddOrUpdateVariable(new ProfileGroupType.GroupTypeVariable("TestSuffix", "TestValue"));

            bp = profileGroupType.GetVariableBySuffix("TestSuffix");
            Assert.IsNotNull(bp);
            Assert.AreEqual(bp.m_Value, "TestValue", "Unexpected GroupTypeVariable, variable value should be TestValue");
            Assert.True(profileGroupType.Variables.Count == 1);
        }
Exemplo n.º 2
0
        public void GetPathValuesBySuffix_Returns_ExpectedPathValues()
        {
            ProfileGroupType.GroupTypeVariable buildPath = new ProfileGroupType.GroupTypeVariable("BuildPath", "Test Build Path");
            ProfileGroupType profileGroupType            = new ProfileGroupType("prefix");

            profileGroupType.AddVariable(buildPath);
            Assert.AreEqual("Test Build Path", profileGroupType.GetVariableBySuffix(buildPath.Suffix).Value);
        }
        public void GetPathValuesBySuffix_Returns_ExpectedPathValues()
        {
            ProfileGroupType.GroupTypeVariable buildPath = new ProfileGroupType.GroupTypeVariable("BuildPath", "Test Build Path");
            ProfileGroupType profileGroupType            = new ProfileGroupType("prefix");
            bool             variableAdded = profileGroupType.AddVariable(buildPath);

            Assert.IsTrue(variableAdded, "Failed to add GroupType variable");
            Assert.AreEqual("Test Build Path", profileGroupType.GetVariableBySuffix(buildPath.Suffix).Value);
        }
Exemplo n.º 4
0
        private string DetermineOptionString(ProfileGroupType groupType)
        {
            ProfileGroupType selectedGroupType = dataSourceSettings.FindGroupType(groupType);

            if (selectedGroupType != null)
            {
                bool custom;
                m_CustomGroupTypes.TryGetValue(groupType.GroupTypePrefix, out custom);
                if (custom && ProfileIndex == m_ProfileTreeView.lastClickedProfile)
                {
                    return("Custom");
                }
                m_CustomGroupTypes[groupType.GroupTypePrefix] = false;

#if (ENABLE_CCD && UNITY_2019_4_OR_NEWER)
                //Could ERR if user has group type prefix that starts with CCD
                if (selectedGroupType.GroupTypePrefix.StartsWith("CCD"))
                {
                    var parts      = selectedGroupType.GroupTypePrefix.Split(ProfileGroupType.k_PrefixSeparator);
                    var badgeName  = String.Join(ProfileGroupType.k_PrefixSeparator.ToString(), parts, 3, parts.Length - 3);
                    var bucketName = selectedGroupType.GetVariableBySuffix($"{nameof(CcdBucket)}{nameof(CcdBucket.Name)}").Value;
                    return(String.Join(ProfileGroupType.k_PrefixSeparator.ToString(), new string[]
                    {
                        "CCD",
                        bucketName,
                        badgeName
                    }));
                }
#endif
                return(selectedGroupType.GroupTypePrefix);
            }
            else
            {
                m_CustomGroupTypes[groupType.GroupTypePrefix] = true;
                return("Custom");
            }
        }