Ejemplo n.º 1
0
        public void ValidateReadOnlyAlignedSeqIndexOf()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            Assert.AreEqual(0, readOnlyAlignedSeq.IndexOf(readOnlyAlignedSeq[0]));
            Assert.AreEqual(10, readOnlyAlignedSeq.IndexOf(readOnlyAlignedSeq[10]));

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq IndexOf successfully"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq IndexOf successfully"));
        }
Ejemplo n.º 2
0
        public void ValidateReadOnlyAlignedSeqContains()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            // Validate ReadOnlyCollection contains
            bool result = readOnlyAlignedSeq.Contains(readOnlyAlignedSeq[0]);

            Assert.IsTrue(result);
            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq contains"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq contains"));
        }
Ejemplo n.º 3
0
        public void ValidateReadOnlyAlignedSeqCtors()
        {
            string expectedAlignedSeqCount = _utilityObj._xmlUtil.GetTextValue(
                Constants.SAMFileWithAllFieldsNode,
                Constants.ExpectedAlignedSeqCountNode);
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            // Validate readonly property.
            Assert.AreEqual(Int32.Parse(expectedAlignedSeqCount, (IFormatProvider)null), readOnlyAlignedSeq.Count);
            Assert.IsTrue(readOnlyAlignedSeq.IsReadOnly);

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq ctor"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq ctor"));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets ReadOnlyCollections
        /// </summary>
        /// <param name="nodeName">XML node name used for different test cases</param>
        /// <returns></returns>
        static ReadOnlyAlignedSequenceCollection GetReadOnlyAlignedSequence(
            string nodeName)
        {
            string filePath = Utility._xmlUtil.GetTextValue(nodeName,
                                                            Constants.FilePathNode);

            SAMParser samParserObj = new SAMParser();

            samParserObj.EnforceDataVirtualization = true;
            SequenceAlignmentMap       alignedSeqList = samParserObj.Parse(filePath);
            IList <SAMAlignedSequence> samAlignedList = alignedSeqList.QuerySequences;

            ReadOnlyAlignedSequenceCollection readOnlyCollections =
                new ReadOnlyAlignedSequenceCollection(samAlignedList);

            return(readOnlyCollections);
        }
Ejemplo n.º 5
0
        public void ValidateReadOnlyAlignedSeqProperties()
        {
            // Get values from XML node.
            string expectedCount = _utilityObj._xmlUtil.GetTextValue(Constants.SAMFileWithAllFieldsNode,
                                                                     Constants.VirtualAlignedSeqCountNode);

            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            // Validate ReadOnlySequenceCollection properties.
            Assert.IsTrue(readOnlyAlignedSeq.IsReadOnly);
            Assert.AreEqual(expectedCount, readOnlyAlignedSeq.Count.ToString((IFormatProvider)null));

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq Properties"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq Properties"));
        }
Ejemplo n.º 6
0
        public void ValidateReadOnlyAlignedSeqRemove()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            // Validate readonly Aligned sequence Remove
            try
            {
                readOnlyAlignedSeq.Remove(readOnlyAlignedSeq[0]);
                Assert.Fail();
            }
            catch (NotSupportedException)
            {
                ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                       "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq Remove"));
                Console.WriteLine(string.Format((IFormatProvider)null,
                                                "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq Remove"));
            }
        }
Ejemplo n.º 7
0
        public void ValidateReadOnlyAlignedSeqInsert()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            // Validate readonly Aligned sequence
            try
            {
                readOnlyAlignedSeq.Insert(0, readOnlyAlignedSeq[10]);
                Assert.Fail();
            }
            catch (NotSupportedException)
            {
                ApplicationLog.WriteLine(string.Format(null,
                                                       "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq insert"));
                Console.WriteLine(string.Format(null,
                                                "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq insert"));
            }
        }
Ejemplo n.º 8
0
        public void ValidateReadOnlyAlignedSeqCopyTo()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            IAlignedSequence[] IAlignedSeqArray = new
                                                  IAlignedSequence[readOnlyAlignedSeq.Count];

            readOnlyAlignedSeq.CopyTo(IAlignedSeqArray, 0);

            for (int index = 0; index < readOnlyAlignedSeq.Count; index++)
            {
                Assert.AreEqual(IAlignedSeqArray[index].Sequences[0].ToString(),
                                readOnlyAlignedSeq[index].Sequences[0].ToString());
            }

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq CopyTo"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection Bvt : Validated the ReadOnlyAlignedSeq CopyTo"));
        }
Ejemplo n.º 9
0
        public void ValidateReadOnlyAlignedSeqGetEnumerator()
        {
            ReadOnlyAlignedSequenceCollection readOnlyAlignedSeq =
                GetReadOnlyAlignedSequence(Constants.SAMFileWithAllFieldsNode);

            IEnumerator <IAlignedSequence> alignedList = readOnlyAlignedSeq.GetEnumerator();

            // Validate enumerator.
            int index = 0;

            while (alignedList.MoveNext())
            {
                Assert.AreEqual(alignedList.Current.Sequences[0].ToString(),
                                readOnlyAlignedSeq[index].Sequences[0].ToString());
                index++;
            }

            ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                   "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq GetEnumerator"));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq GetEnumerator"));
        }
Ejemplo n.º 10
0
        public void ValidateReadOnlyAlignedSeqGetIEnumerable()
        {
            string filePath = Utility._xmlUtil.GetTextValue(Constants.SAMFileWithAllFieldsNode,
                                                            Constants.FilePathNode);

            SAMParser samParserObj = new SAMParser();

            samParserObj.EnforceDataVirtualization = true;
            SequenceAlignmentMap       alignedSeqList = samParserObj.Parse(filePath);
            IList <SAMAlignedSequence> samAlignedList = alignedSeqList.QuerySequences;

            IEnumerable readOnlyCollections =
                new ReadOnlyAlignedSequenceCollection(samAlignedList);

            IEnumerator enumerator = readOnlyCollections.GetEnumerator();

            Assert.IsNotNull(enumerator);

            ApplicationLog.WriteLine(string.Format(null,
                                                   "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq GetEnumerator"));
            Console.WriteLine(string.Format(null,
                                            "ReadOnlyAlignedSeqCollection P1 : Validated the ReadOnlyAlignedSeq GetEnumerator"));
        }