public void ValidateGenBankLocationPositions() { // Get Values from XML node. string location = utilityObj.xmlUtil.GetTextValue( Constants.LocationWithEndDataUsingOperatorNode, Constants.Location); string expectedEndData = utilityObj.xmlUtil.GetTextValue( Constants.LocationWithEndDataUsingOperatorNode, Constants.EndData); string expectedStartData = utilityObj.xmlUtil.GetTextValue( Constants.LocationWithEndDataUsingOperatorNode, Constants.StartData); string position = utilityObj.xmlUtil.GetTextValue( Constants.LocationWithEndDataUsingOperatorNode, Constants.Position); bool result = false; // Build a location. var locResolver = new LocationResolver(); ILocationBuilder locBuilder = new LocationBuilder(); var loc = (Location) locBuilder.GetLocation(location); loc.EndData = expectedEndData; loc.StartData = expectedStartData; // Validate whether mentioned end data is present in the location // or not. result = locResolver.IsInEnd(loc, Int32.Parse(position, null)); Assert.IsTrue(result); // Validate whether mentioned start data is present in the location // or not. result = locResolver.IsInStart(loc, Int32.Parse(position, null)); Assert.IsTrue(result); // Validate whether mentioned data is present in the location // or not. result = locResolver.IsInRange(loc, Int32.Parse(position, null)); Assert.IsTrue(result); // Log to VSTest GUI. ApplicationLog.WriteLine(string.Format(null, "GenBankFeatures P1 : Expected sequence is verified")); }
public void InValidateGenBankLocationEndData() { // Get Values from XML node. string position = utilityObj.xmlUtil.GetTextValue( Constants.LocationWithEndDataNode, Constants.Position); // Build a location. LocationResolver locResolver = new LocationResolver(); // Validate whether mentioned end data is present in the location // or not. try { locResolver.IsInEnd(null, Int32.Parse(position, (IFormatProvider)null)); Assert.Fail(); } catch (ArgumentNullException) { ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "GenBankFeatures P2 : Validate the exception successfully")); } // Validate IsInStart method exception. try { locResolver.IsInStart(null, Int32.Parse(position, (IFormatProvider)null)); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } // Validate IsInRange method exception. try { locResolver.IsInRange(null, Int32.Parse(position, (IFormatProvider)null)); Assert.Fail(); } catch (ArgumentNullException) { LogExceptionMessage(); } }
public void ValidateGenBankLocationStartAndEndRange() { // Get Values from XML node. string filePath = utilityObj.xmlUtil.GetTextValue( Constants.GenBankRepeatRegionQualifiersNode, Constants.FilePathNode); bool startLocResult = false; bool endLocResult = false; bool rangeLocResult = false; // Parse a GenBank file. ISequenceParser parserObj = new GenBankParser(); { ISequence sequence = parserObj.ParseOne(filePath); ILocationResolver locResolver = new LocationResolver(); // Validate Start,End and Range of Gene feature location. var metadata = (GenBankMetadata) sequence.Metadata[Constants.GenBank]; startLocResult = locResolver.IsInStart(metadata.Features.Genes[0].Location, 289); endLocResult = locResolver.IsInEnd(metadata.Features.Genes[0].Location, 1647); rangeLocResult = locResolver.IsInRange(metadata.Features.Genes[0].Location, 300); Assert.IsTrue(startLocResult); Assert.IsTrue(endLocResult); Assert.IsTrue(rangeLocResult); // Log VSTest GUI. ApplicationLog.WriteLine( "GenBank Features P1: Successfully validated the location resolver Gene feature start End and IsInRange methods"); } }