public void ValidateDerivedSequenceConvertToString() { string seqLargeStr = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName, Constants.seqLargeStringNode); ISequence seqLarge = new Sequence(Alphabets.DNA, seqLargeStr); ISequence DeriveSeqLarge = new DerivedSequence(seqLarge, false, true); string ActualLargeString = DeriveSeqLarge.ToString(); string seqLargeExpected = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName, Constants.seqLargeExpectedNode); string expectedLargeString = string.Format(CultureInfo.CurrentCulture, seqLargeExpected, (seqLarge.Count - Helper.AlphabetsToShowInToString)); Assert.AreEqual(expectedLargeString, ActualLargeString); // Get input and expected values from xml string expectedSequence = this.utilityObj.xmlUtil.GetTextValue( Constants.ProteinDerivedSequenceNode, Constants.ExpectedSequence); string alphabetName = this.utilityObj.xmlUtil.GetTextValue( Constants.ProteinDerivedSequenceNode, Constants.AlphabetNameNode); IAlphabet alphabet = Utility.GetAlphabet(alphabetName); // Create derived Sequence ISequence seq = new Sequence(alphabet, expectedSequence); var derSequence = new DerivedSequence(seq, false, false); Assert.AreEqual(expectedSequence.Substring(2, 5), derSequence.ConvertToString(2, 5)); }
public void TestDerivedSequenceConvertToString() { Sequence baseSeq = new Sequence(Alphabets.DNA, "ATCGATCGGATCGATCGGCTACTAATATCGATCGGCTACGATCGGCTAATCGATCGATCGGCTAATCGATCGATCGGCTAGCTA"); DerivedSequence seq = new DerivedSequence(baseSeq, false, false); const string expectedValue = "TCGATCGGCT"; string actualValue = seq.ConvertToString(10, 10); Assert.AreEqual(expectedValue, actualValue); }
public void TestDerivedSequenceConvertToString() { Sequence baseSeq = new Sequence(Alphabets.DNA, "ATCGATCGGATCGATCGGCTACTAATATCGATCGGCTACGATCGGCTAATCGATCGATCGGCTAATCGATCGATCGGCTAGCTA"); DerivedSequence seq = new DerivedSequence(baseSeq, false, false); const string expectedValue = "TCGATCGGCT"; string actualValue = seq.ConvertToString(10, 10); Assert.AreEqual(expectedValue, actualValue); }
public void InvalidateDerivedSequenceConvertToString() { try { //check with blank sequene var baseSeq = new Sequence(Alphabets.DNA, ""); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with length greater than actual length var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 30); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with length < 0 var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, -30); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with start index < 0 var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(-10, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with start index greater than actual length var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(30, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with null sequence Sequence baseSeq = null; var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 3); Assert.Fail(); } catch (NullReferenceException nre) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + nre.Message); } }
public void ValidateDerivedSequenceConvertToString() { string seqLargeStr = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName, Constants.seqLargeStringNode); ISequence seqLarge = new Sequence(Alphabets.DNA, seqLargeStr); ISequence DeriveSeqLarge = new DerivedSequence(seqLarge, false, true); string ActualLargeString = DeriveSeqLarge.ToString(); string seqLargeExpected = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName, Constants.seqLargeExpectedNode); string expectedLargeString = string.Format(CultureInfo.CurrentCulture, seqLargeExpected, (seqLarge.Count - Helper.AlphabetsToShowInToString)); Assert.AreEqual(expectedLargeString, ActualLargeString); // Get input and expected values from xml string expectedSequence = this.utilityObj.xmlUtil.GetTextValue( Constants.ProteinDerivedSequenceNode, Constants.ExpectedSequence); string alphabetName = this.utilityObj.xmlUtil.GetTextValue( Constants.ProteinDerivedSequenceNode, Constants.AlphabetNameNode); IAlphabet alphabet = Utility.GetAlphabet(alphabetName); // Create derived Sequence ISequence seq = new Sequence(alphabet, expectedSequence); var derSequence = new DerivedSequence(seq, false, false); Assert.AreEqual(expectedSequence.Substring(2, 5), derSequence.ConvertToString(2, 5)); }
public void InvalidateDerivedSequenceConvertToString() { try { //check with blank sequene var baseSeq = new Sequence(Alphabets.DNA, ""); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with length greater than actual length var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 30); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with length < 0 var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, -30); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with start index < 0 var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(-10, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with start index greater than actual length var baseSeq = new Sequence(Alphabets.DNA, "ATGCCCC"); var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(30, 3); Assert.Fail(); } catch (ArgumentOutOfRangeException aorex) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + aorex.Message); } try { //check with null sequence Sequence baseSeq = null; var seq = new DerivedSequence(baseSeq, false, false); string seqStr = seq.ConvertToString(0, 3); Assert.Fail(); } catch (NullReferenceException nre) { ApplicationLog.WriteLine("Successfully caught ArgumentOutOfRangeException : " + nre.Message); } }