public void InValidateSubSequenceWithComplimentOperator() { // Get Values from XML node. string sequence = utilityObj.xmlUtil.GetTextValue( Constants.InvalidLocationWithComplementOperatorNode, Constants.ExpectedSequence); string location = utilityObj.xmlUtil.GetTextValue( Constants.InvalidLocationWithComplementOperatorNode, Constants.Location); string alphabet = utilityObj.xmlUtil.GetTextValue( Constants.InvalidLocationWithComplementOperatorNode, Constants.AlphabetNameNode); // Create a sequence object. ISequence seqObj = new Sequence(Utility.GetAlphabet(alphabet), sequence); // Build a location. ILocationBuilder locBuilder = new LocationBuilder(); ILocation loc = locBuilder.GetLocation(location); LocationResolver locResolver = new LocationResolver(); // Get sequence using location of the sequence with operator. try { loc.GetSubSequence(seqObj); Assert.Fail(); } catch (ArgumentException) { LogExceptionMessage(); } // Validate sub sequence exception for an invalid sequence. try { locResolver.GetSubSequence(loc, null); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } // Validate GetSubSequence method with null location. try { locResolver.GetSubSequence(null, seqObj); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } // Validate sub sequence exception for an invalid sequence. try { locResolver.GetSubSequence(loc, null, null); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } // Validate GetSubSequence method with null location. try { locResolver.GetSubSequence(null, seqObj, null); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } // Validate GetSubSequence method with null location. try { loc.GetSubSequence(null); Assert.Fail(); } catch (ArgumentNullException) { ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "GenBankFeatures P2 : Validate the exception successfully")); } }
public void ValidateGenBankSubSequence() { // Get Values from XML node. string filePath = utilityObj.xmlUtil.GetTextValue( Constants.GenBankRepeatRegionQualifiersNode, Constants.FilePathNode); string expectedSubSequence = utilityObj.xmlUtil.GetTextValue( Constants.GenBankRepeatRegionQualifiersNode, Constants.ExpectedFeatureSubSequence); // Parse a GenBank file. ISequenceParser parserObj = new GenBankParser(); { ISequence sequence = parserObj.ParseOne(filePath); ILocationResolver locResolver = new LocationResolver(); // Get repeatregion subsequence. var metadata = (GenBankMetadata) sequence.Metadata[Constants.GenBank]; ISequence subSeq = locResolver.GetSubSequence( metadata.Features.RepeatRegions[0].Location, sequence); var sequenceString = new string(subSeq.Select(a => (char) a).ToArray()); // Validate repeat region subsequence. Assert.AreEqual(sequenceString, expectedSubSequence); // Log VSTest GUI. ApplicationLog.WriteLine( "GenBank Features P1: Successfully validated the GenBank subSequence"); } }