Exemple #1
0
        public void TestEditingWhenIsReadOnlyIsTrue()
        {
            QualitativeSequence qualSequence = new QualitativeSequence(Alphabets.RNA, FastQFormatType.Illumina, "ACUGGA", 65);

            Assert.IsTrue(qualSequence.IsReadOnly);

            try
            {
                qualSequence.Clear();
                Assert.Fail();
            }
            catch
            {
                Assert.AreEqual(qualSequence.Count, 6);
            }

            try
            {
                qualSequence.Add(Alphabets.RNA.AC);
                Assert.Fail();
            }
            catch
            {
                Assert.AreEqual(qualSequence.Count, 6);
            }

            try
            {
                qualSequence.Remove(Alphabets.RNA.AC);
                Assert.Fail();
            }
            catch
            {
                Assert.AreEqual(qualSequence.Count, 6);
            }

            try
            {
                qualSequence.Replace(0, Alphabets.RNA.AC.Symbol);
                Assert.Fail();
            }
            catch
            {
                Assert.AreEqual(qualSequence.Count, 6);
            }
        }
Exemple #2
0
        public void TestEditingwhenIsReadOnlyIsFalse()
        {
            QualitativeSequence qualSequence = new QualitativeSequence(Alphabets.RNA, FastQFormatType.Illumina, "ACUGGA", 65);

            Assert.IsTrue(qualSequence.IsReadOnly);
            qualSequence.IsReadOnly = false;

            Assert.AreEqual(qualSequence.Count, 6);
            Assert.AreEqual(qualSequence.ToString(), "ACUGGA");

            qualSequence.Clear();
            Assert.AreEqual(qualSequence.Count, 0);
            Assert.AreEqual(qualSequence.Scores.Length, 0);

            qualSequence.Add(Alphabets.RNA.A, 65);
            Assert.AreEqual(qualSequence.Count, 1);
            Assert.AreEqual(qualSequence.Scores.Length, 1);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Scores[0], 65);

            qualSequence.Insert(0, Alphabets.RNA.G, 70);
            Assert.AreEqual(qualSequence.Count, 2);
            Assert.AreEqual(qualSequence.Scores.Length, 2);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.G);
            Assert.AreSame(qualSequence[1], Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Scores[0], 70);
            Assert.AreEqual(qualSequence.Scores[1], 65);

            qualSequence.Replace(0, Alphabets.RNA.U, 75);
            Assert.AreEqual(qualSequence.Count, 2);
            Assert.AreEqual(qualSequence.Scores.Length, 2);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.U);
            Assert.AreSame(qualSequence[1], Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Scores[0], 75);
            Assert.AreEqual(qualSequence.Scores[1], 65);

            qualSequence.Remove(Alphabets.RNA.C);
            Assert.AreEqual(qualSequence.Count, 2);
            Assert.AreEqual(qualSequence.Scores.Length, 2);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.U);
            Assert.AreSame(qualSequence[1], Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Scores[0], 75);
            Assert.AreEqual(qualSequence.Scores[1], 65);

            qualSequence.Remove(Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Count, 1);
            Assert.AreEqual(qualSequence.Scores.Length, 1);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.U);
            Assert.AreEqual(qualSequence.Scores[0], 75);

            qualSequence.Add(Alphabets.RNA.A, 65);
            Assert.AreEqual(qualSequence.Count, 2);
            Assert.AreEqual(qualSequence.Scores.Length, 2);
            Assert.AreSame(qualSequence[0], Alphabets.RNA.U);
            Assert.AreSame(qualSequence[1], Alphabets.RNA.A);
            Assert.AreEqual(qualSequence.Scores[0], 75);
            Assert.AreEqual(qualSequence.Scores[1], 65);

            qualSequence.RemoveAt(1);
            Assert.AreEqual(qualSequence.Count, 1);
            Assert.AreEqual(qualSequence.Scores.Length, 1);
        }