Ejemplo n.º 1
0
        public void Equality()
        {
            // happy path
            var testRegion  = new MyRegionState(1500, 7002);
            var otherRegion = new MyRegionState(1500, 7002);

            Assert.True(testRegion.Equals(otherRegion));
            Assert.True(otherRegion.Equals(testRegion));

            // error conditions
            otherRegion = new MyRegionState(1501, 7002); // diff start
            Assert.False(testRegion.Equals(otherRegion));
            otherRegion = new MyRegionState(1500, 7001); // diff end
            Assert.False(testRegion.Equals(otherRegion));

            Assert.False(testRegion.Equals("otherobject"));
        }
        public virtual void DoneProcessing(ICandidateBatch batch)
        {
            var candidateBatch = batch as CandidateBatch;

            if (candidateBatch != null)
            {
                foreach (var key in candidateBatch.BlockKeys)
                {
                    var blockToRemove = _regionLookup[key];
                    _reusableBlocks.Push(blockToRemove); // save for reuse later

                    _regionLookup.Remove(key);

                    if (_lastAccessedBlock != null && _lastAccessedBlock.Equals(blockToRemove))
                    {
                        _lastAccessedBlock = null;
                    }
                }
            }
        }