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")); }
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")); }
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")); }
/// <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); }
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")); }
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")); } }
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")); } }
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")); }
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")); }
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")); }