コード例 #1
0
        public void AddPosition_NewPositionInRange_EmptyBufferReturned()
        {
            var position1 = GetMockedIPositionOnChr1(99, 99);

            _geneIntervalForestMock.Setup(x => x.OverlapsAny(0, 100, 100)).Returns(true);
            _codonInfoProviderMock.Setup(x => x.GetLongestFunctionBlockDistance(position1)).Returns(101);
            var positionBuffer = new PositionBuffer(_codonInfoProviderMock.Object, _geneIntervalForestMock.Object);

            positionBuffer.AddPosition(position1);
            var position2         = GetMockedIPositionOnChr1(100, 100, "C");
            var bufferedPositions = positionBuffer.AddPosition(position2);

            Assert.IsType <BufferedPositions>(bufferedPositions);
            Assert.Empty(bufferedPositions.SimplePositions);
            Assert.Empty(bufferedPositions.Recomposable);
        }
コード例 #2
0
        public void AddPosition_ChromosomeUpdated_WhenFirstPositionAdded()
        {
            var positionBuffer = new PositionBuffer(_codonInfoProviderMock.Object, _geneIntervalForestMock.Object);
            var position       = GetMockedIPositionOnChr1(99, 99);

            positionBuffer.AddPosition(position);
            Assert.Equal(new Chromosome("chr1", "1", 0), positionBuffer.CurrentChromosome);
        }
コード例 #3
0
        public void PositionWithinRange_Position_OutGeneRegion_ReturnFalse()
        {
            var position1 = GetMockedIPositionOnChr1(99, 99);

            _geneIntervalForestMock.Setup(x => x.OverlapsAny(0, 100, 100)).Returns(false);
            _codonInfoProviderMock.Setup(x => x.GetLongestFunctionBlockDistance(position1)).Returns(101);
            var positionBuffer = new PositionBuffer(_codonInfoProviderMock.Object, _geneIntervalForestMock.Object);

            positionBuffer.AddPosition(position1);
            var position2 = GetMockedIPositionOnChr1(100, 100, "C");

            Assert.False(positionBuffer.PositionWithinRange(position2));
        }
コード例 #4
0
        public void Purge_BufferedPositionsPurged()
        {
            var position1 = GetMockedIPositionOnChr1(99, 99);
            var position2 = GetMockedIPositionOnChr1(100, 100, ".");

            _geneIntervalForestMock.Setup(x => x.OverlapsAny(0, 100, 100)).Returns(true);
            _codonInfoProviderMock.Setup(x => x.GetLongestFunctionBlockDistance(position1)).Returns(101);
            _codonInfoProviderMock.Setup(x => x.GetLongestFunctionBlockDistance(position2)).Returns(101);
            var positionBuffer = new PositionBuffer(_codonInfoProviderMock.Object, _geneIntervalForestMock.Object);

            positionBuffer.AddPosition(position1);
            positionBuffer.AddPosition(position2);
            var bufferedPositions = positionBuffer.Purge();

            Assert.IsType <BufferedPositions>(bufferedPositions);
            Assert.Equal(2, bufferedPositions.SimplePositions.Count);
            Assert.Equal(2, bufferedPositions.Recomposable.Count);
            Assert.True(bufferedPositions.SimplePositions[0].Equals(position1));
            Assert.True(bufferedPositions.SimplePositions[1].Equals(position2));
            Assert.True(bufferedPositions.Recomposable[0]);
            Assert.False(bufferedPositions.Recomposable[1]);
        }
コード例 #5
0
        public void PositionWithinRange_Position_InRange_ReturnTrue()
        {
            var position1 = GetMockedIPositionOnChr1(99, 99);

            _geneIntervalForestMock.Setup(x => x.OverlapsAny(0, 100, 100)).Returns(true);
            _codonInfoProviderMock.Setup(x => x.GetFunctionBlockRanges(position1)).Returns(101);
            var positionBuffer = new PositionBuffer(_codonInfoProviderMock.Object, _geneIntervalForestMock.Object);

            positionBuffer.AddPosition(position1);
            var position2 = GetMockedIPositionOnChr1(100, 100, "C");

            Assert.True(positionBuffer.PositionWithinRange(position2));
        }