示例#1
0
        private List <int> GetAllRefCounts(RegionState testRegion)
        {
            var refCounts = new List <int>();

            for (int position = testRegion.StartPosition; position <= testRegion.EndPosition; position++)
            {
                refCounts.Add(testRegion.GetGappedMnvRefCount(position));
            }

            return(refCounts);
        }
示例#2
0
        public void AddAndGetGappedMnvReferenceCounts()
        {
            var testRegion = new RegionState(50, 150);

            // -----------------------------------------------
            // happy path - add a couple of counts,
            // getting them should return the same
            // -----------------------------------------------
            testRegion.AddGappedMnvRefCount(75, 1);
            testRegion.AddGappedMnvRefCount(76, 10);
            Assert.Equal(1, testRegion.GetGappedMnvRefCount(75));
            Assert.Equal(10, testRegion.GetGappedMnvRefCount(76));

            // -----------------------------------------------
            // happy path - add a couple of counts to existing ref,
            // it should be incremented but others should be unchanged
            // -----------------------------------------------
            testRegion.AddGappedMnvRefCount(76, 3);
            Assert.Equal(1, testRegion.GetGappedMnvRefCount(75));
            Assert.Equal(13, testRegion.GetGappedMnvRefCount(76));
        }
示例#3
0
        public void AddAndGetGappedMnvReferenceCounts_Errors()
        {
            var testRegion = new RegionState(50, 150);

            testRegion.AddGappedMnvRefCount(150, 10);

            var refCountsBefore = GetAllRefCounts(testRegion);

            // -----------------------------------------------
            // adding at an invalid position should do nothing
            // -----------------------------------------------
            testRegion.AddGappedMnvRefCount(151, 1);
            var refCountsAfter = GetAllRefCounts(testRegion);

            Assert.True(refCountsAfter.SequenceEqual(refCountsBefore));

            // -----------------------------------------------
            // getting at an invalid position should throw exception
            // -----------------------------------------------
            Assert.Throws <ArgumentException>(() => testRegion.GetGappedMnvRefCount(151));
        }