void InValidateFastQFormatter(FastQFormatParameters param) { // Gets the expected sequence from the Xml string filepath = utilityObj.xmlUtil.GetTextValue( Constants.MultiSeqSangerRnaProNode, Constants.FilePathNode); // Parse a FastQ file. using (FastQParser fastQParser = new FastQParser(filepath)) { fastQParser.AutoDetectFastQFormat = true; IEnumerable <QualitativeSequence> sequence = null; FastQFormatter fastQFormatter = null; switch (param) { case FastQFormatParameters.Sequence: try { fastQFormatter = new FastQFormatter(filepath); fastQFormatter.Write(null as ISequence); Assert.Fail(); } catch (ArgumentNullException) { fastQFormatter.Close(); ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; default: try { sequence = fastQParser.Parse(); fastQFormatter = new FastQFormatter(Constants.FastQTempFileName); fastQFormatter.Write(sequence as QualitativeSequence); Assert.Fail(); } catch (ArgumentNullException) { fastQFormatter.Close(); ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; } } }
private void InValidateFastQFormatter(FastQFormatParameters param) { // Gets the expected sequence from the Xml string filepath = utilityObj.xmlUtil.GetTextValue( Constants.MultiSeqSangerRnaProNode, Constants.FilePathNode); // Parse a FastQ file. var fastQParser = new FastQParser(); using (fastQParser.Open(filepath)) { FastQFormatter fastQFormatter = null; switch (param) { case FastQFormatParameters.Sequence: try { fastQFormatter = new FastQFormatter(); fastQFormatter.Format(null as ISequence, filepath); Assert.Fail(); } catch (ArgumentNullException) { fastQFormatter.Close(); ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; default: try { IEnumerable <IQualitativeSequence> sequence = fastQParser.Parse(); fastQFormatter = new FastQFormatter(); fastQFormatter.Format(sequence, null); Assert.Fail(); } catch (ArgumentNullException) { ApplicationLog.WriteLine("FastQ Parser P2 : Successfully validated the exception"); } break; } } }
private void InValidateFastQFormatter(FastQFormatParameters param) { // Gets the expected sequence from the Xml string filepath = utilityObj.xmlUtil.GetTextValue( Constants.MultiSeqSangerRnaProNode, Constants.FilePathNode); // Parse a FastQ file. var fastQParser = new FastQParser(); using (fastQParser.Open(filepath)) { FastQFormatter fastQFormatter = null; switch (param) { case FastQFormatParameters.Sequence: try { fastQFormatter = new FastQFormatter(); fastQFormatter.Format(null as ISequence, filepath); Assert.Fail(); } catch (ArgumentNullException) { fastQFormatter.Close(); ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; default: try { IEnumerable<IQualitativeSequence> sequence = fastQParser.Parse(); fastQFormatter = new FastQFormatter(); fastQFormatter.Format(sequence, null); Assert.Fail(); } catch (ArgumentNullException) { ApplicationLog.WriteLine("FastQ Parser P2 : Successfully validated the exception"); } break; } } }
/// <summary> /// General method to Invalidate FastQ Parser. /// <param name="nodeName">xml node name.</param> /// <param name="param">FastQ Formatter different parameters</param> /// </summary> void InValidateFastQFormatter(FastQFormatParameters param) { // Gets the expected sequence from the Xml string filepath = _utilityObj._xmlUtil.GetTextValue( Constants.MultiSeqSangerRnaProNode, Constants.FilePathNode); FastQFormatType expectedFormatType = Utility.GetFastQFormatType( _utilityObj._xmlUtil.GetTextValue(Constants.MultiSeqSangerRnaProNode, Constants.FastQFormatType)); // Parse a FastQ file. using (FastQParser fastQParser = new FastQParser()) { fastQParser.AutoDetectFastQFormat = true; fastQParser.FastqType = expectedFormatType; IQualitativeSequence sequence = null; sequence = fastQParser.ParseOne(filepath); FastQFormatter fastQFormatter = new FastQFormatter(); TextWriter txtWriter = null; switch (param) { case FastQFormatParameters.TextWriter: try { fastQFormatter.Format(sequence, null as TextWriter); Assert.Fail(); } catch (Exception) { ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; case FastQFormatParameters.Sequence: try { fastQFormatter.Format(null as ISequence, txtWriter); Assert.Fail(); } catch (Exception) { ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; case FastQFormatParameters.QualitativeSequence: try { fastQFormatter.Format(null as IQualitativeSequence, txtWriter); Assert.Fail(); } catch (Exception) { ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; default: try { fastQFormatter.Format(sequence as QualitativeSequence, null as TextWriter); Assert.Fail(); } catch (Exception) { ApplicationLog.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); Console.WriteLine( "FastQ Parser P2 : Successfully validated the exception"); } break; } } }