コード例 #1
0
        public void Parse_ShouldAssumeParsingAmbiguousSequenceAsNucleicAcidSequence()
        {
            const string    nucleicAcidSequenceString = "ABCD";
            IActualSequence sequenceData = ActualSequenceParser.Parse(nucleicAcidSequenceString);

            Assert.IsNotNull(sequenceData);
            Assert.IsInstanceOfType(sequenceData, typeof(NucleicAcidSequence));
            var nucelicAcidSequenceData = (NucleicAcidSequence)sequenceData;

            Assert.AreEqual(nucleicAcidSequenceString, nucelicAcidSequenceData.Characters);
        }
コード例 #2
0
        public void Parse_ShouldParseAminoAcidSequence()
        {
            const string    aminoAcidSequenceString = "ABCZ";
            IActualSequence sequenceData            = ActualSequenceParser.Parse(aminoAcidSequenceString);

            Assert.IsNotNull(sequenceData);
            Assert.IsInstanceOfType(sequenceData, typeof(AminoAcidSequence));
            var aminoAcidSequenceData = (AminoAcidSequence)sequenceData;

            Assert.AreEqual(aminoAcidSequenceString, aminoAcidSequenceData.Characters);
        }
コード例 #3
0
        private static Sequence ParseBase(IEnumerable <string> lines)
        {
            try
            {
                IEnumerable <string> nonBlankLines = lines.Where(line => !string.IsNullOrWhiteSpace(line));

                Header          header       = Header.Parse(nonBlankLines.First());
                IActualSequence sequenceData = ActualSequenceParser.Parse(nonBlankLines.Skip(1));

                return(new Sequence(header, sequenceData));
            }
            catch (FormatException ex)
            {
                throw new FormatException("The collection of sequence lines are not in the correct format.", ex);
            }
        }
コード例 #4
0
 public void Parse_ShouldRejectAllWhitespaceText()
 {
     _ = ActualSequenceParser.Parse("     ");
 }
コード例 #5
0
 public void Parse_ShouldRejectNullLinesCollection()
 {
     _ = ActualSequenceParser.Parse((IEnumerable <string>)null);
 }
コード例 #6
0
 public void Parse_ShouldRejectNullText()
 {
     _ = ActualSequenceParser.Parse((string)null);
 }