Пример #1
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));
        }
Пример #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));
        }