void InvalidateSet(ChildMatchInfo matchInfo)
        {
            // Just one trait not matching should cause a loss.
            var firstFloatTrait = matchInfo.floatTraits.First();

            m_FloatTraitProvider.RemoveTrait(matchInfo.dataID, firstFloatTrait.Key);
        }
        public void Update()
        {
            for (int i = s_RemoveIndex; i < s_RemoveIndex + s_DataCount; i++)
            {
                m_Provider.RemoveTrait(s_DataIds[i], m_TraitNames[i]);
            }

            s_RemoveIndex += s_DataCount;
        }
        public void TryUpdateSetQueryMatchData_MatchLostForOrdinaryCondition_ReturnsFalse()
        {
            SetQueryResult result;
            var            childrenExpectedMatchInfo = new Dictionary <IMRObject, ChildMatchInfo>();
            var            relations = MakeBaseSet(out result, childrenExpectedMatchInfo);

            AddDataThatMatchesQuery(childrenExpectedMatchInfo);
            AssignExpectedMatchInfo(childrenExpectedMatchInfo);

            Assert.True(m_Db.TryUpdateSetQueryMatchData(m_MatchingData, relations, result));

            // Remove a tag trait needed by a child condition.
            var firstMatchInfo = childrenExpectedMatchInfo.First().Value;

            m_TagTraitProvider.RemoveTrait(firstMatchInfo.dataID, firstMatchInfo.semanticTagTraits.First().Key);

            Assert.False(m_Db.TryUpdateSetQueryMatchData(m_MatchingData, relations, result));
        }
        public void AddGetRemove_TraitValue <T>(int id, string traitName, T traitValue)
        {
            var provider = new MARSTraitDataProvider <T>(dataId => { }, m_Db);

            provider.AddOrUpdateTrait(id, traitName, traitValue);

            T retrievedValue;

            provider.TryGetTraitValue(id, traitName, out retrievedValue);
            Assert.AreEqual(traitValue, retrievedValue);

            Assert.True(provider.RemoveTrait(id, traitName));

            T postRemovalValue;

            Assert.False(provider.TryGetTraitValue(id, traitName, out postRemovalValue));
            Assert.AreEqual(default(T), postRemovalValue);
        }
Exemplo n.º 5
0
 public void TryUpdateQueryMatchData_TagMatchRemoved_ReturnsFalse()
 {
     TestDataThatMatchesQuery();
     m_TagTraitProvider.RemoveTrait(k_DataID, TraitNameForIndex(0));
     Assert.False(m_Db.TryUpdateQueryMatchData(m_DataID, m_Conditions, m_EmptyTraitRequirements, m_QueryResult));
 }