示例#1
0
        public override void AfterCreate(EntryEvent <TKey, TVal> ev)
        {
            m_numAfterCreate++;
            TKey          key   = (TKey)ev.Key;
            DeltaTestImpl value = ev.NewValue as DeltaTestImpl;

            if (value == null)
            {
                FwkTest <TKey, TVal> .CurrentTest.FwkException(" Value in afterCreate cannot be null : key = {0} ", key.ToString());

                return;
            }
            if (value.GetIntVar() != 0 && value.GetFromDeltaCounter() != 0)
            {
                ValidateIncreamentByOne(key, value);
            }
            Int32 mapValue   = value.GetIntVar();
            Int64 deltaValue = value.GetFromDeltaCounter();

            m_latestValues[key] = mapValue;
            m_ValidateMap[key]  = deltaValue;
        }
示例#2
0
        public override void AfterUpdate(EntryEvent <TKey, TVal> ev)
        {
            m_numAfterUpdate++;
            TKey          key      = ev.Key;
            DeltaTestImpl oldValue = ev.OldValue as DeltaTestImpl;
            DeltaTestImpl newValue = ev.NewValue as DeltaTestImpl;

            if (newValue == null)
            {
                FwkTest <TKey, TVal> .CurrentTest.FwkException(" newValue in afterUpdate cannot be null : key = {0} ", key.ToString());

                return;
            }
            if (oldValue == null)
            {
                ValidateIncreamentByOne(key, newValue);
            }
            else
            {
                Int32 mapValue1;
                m_latestValues.TryGetValue(key, out mapValue1);
                Int32 mapValue2 = mapValue1;
                // CacheableInt32 mapValue2 = m_latestValues[key] as CacheableInt32;
                Int32 diff = newValue.GetIntVar() - mapValue2;
                if (diff != 1)
                {
                    FwkTest <TKey, TVal> .CurrentTest.FwkException("difference expected in newValue and oldValue is 1 , but it was not" +
                                                                   " for key {0} & newVal = {1} oldValue = {2} map count = {3} : {4}", key.ToString(), newValue.GetIntVar(), mapValue2, m_latestValues.Count, m_latestValues.ToString());

                    return;
                }
            }
            Int32 mapValue   = newValue.GetIntVar();
            Int64 deltaValue = newValue.GetFromDeltaCounter();

            m_latestValues[key] = mapValue;
            m_ValidateMap[key]  = deltaValue;
        }