Exemple #1
0
        public void FindFastaFromater()
        {
            string             dummyFileName = "dummy.fasta";
            ISequenceFormatter formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);

            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.fa";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.mpfa";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.fna";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.faa";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.fsa";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);

            dummyFileName = "dummy.fas";
            formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);
            Assert.IsInstanceOf(typeof(FastaFormatter), formatter);
        }
Exemple #2
0
        public void FindGenBankFromatter()
        {
            string             dummyFileName = "dummy.gb";
            ISequenceFormatter formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);

            Assert.IsInstanceOf(typeof(GenBankFormatter), formatter);
        }
Exemple #3
0
        public void ReturnNoFormatter()
        {
            string             dummyFileName = "dummy.abc";
            ISequenceFormatter formatter     = SequenceFormatters.FindFormatterByFile(dummyFileName);

            Assert.AreEqual(formatter, null);
        }
Exemple #4
0
        /// <summary>
        /// Validates general Sequence Parser.
        /// </summary>
        /// <param name="nodeName">xml node name.</param>
        /// <param name="IsParser">IsParser is true if testcases is validating Parsers,
        /// false if formatter validation</param>
        void ValidateSequenceFileParser(string nodeName, bool IsParser)
        {
            // Gets the expected sequence from the Xml
            string[] filePaths = _utilityObj._xmlUtil.GetTextValues(nodeName,
                                                                    Constants.FilePathsNode);
            string parserDescription = _utilityObj._xmlUtil.GetTextValue(nodeName,
                                                                         Constants.DescriptionNode);
            string parserName = _utilityObj._xmlUtil.GetTextValue(nodeName,
                                                                  Constants.ParserNameNode);
            string fileTypes = _utilityObj._xmlUtil.GetTextValue(nodeName,
                                                                 Constants.FileTypesNode);

            // Get a default parser for the file types.
            for (int i = 0; i < filePaths.Length; i++)
            {
                if (IsParser)
                {
                    ISequenceParser parser      = SequenceParsers.FindParserByFile(filePaths[i]);
                    string          description = parser.Description.Replace("\r", "").Replace("\n", "");
                    // Validate parser name, description and the file type supported by parser.
                    Assert.AreEqual(parserName, parser.Name);
                    Assert.AreEqual(parserDescription, description);
                    Assert.AreEqual(fileTypes, parser.FileTypes);
                }
                else
                {
                    ISequenceFormatter formatter =
                        SequenceFormatters.FindFormatterByFile(filePaths[i]);
                    string description =
                        formatter.Description.Replace("\r", "").Replace("\n", "");
                    // Validate parser name, description and the file type supported by parser.
                    Assert.AreEqual(parserName, formatter.Name);
                    Assert.AreEqual(parserDescription, description);
                    Assert.AreEqual(fileTypes, formatter.FileTypes);
                }
            }

            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "SequenceParser : Type of the parser is validated successfully"));
            ApplicationLog.WriteLine("Type of the parser is validated successfully");
        }