Esempio n. 1
0
        /// <summary>
        /// General method to invalidate Argument Null exceptions generated from different methods.
        /// </summary>
        /// <param name="nodeName">xml node name.</param>
        /// <param name="method">Gff Parse method parameters</param>
        void InvalidateGffWriteMethod(ArgumentNullExceptions method)            
        {
            ISequence sequence=null;
            List<ISequence> collection = new List<ISequence>();
            string sequenceData = null;
            GffFormatter gffFormatter = null;

            try
            {                
                switch (method)
                {
                    case ArgumentNullExceptions.writeWithEmptyFile:
                        sequenceData = utilityObj.xmlUtil.GetTextValue(
                        Constants.SimpleGffDnaNodeName, Constants.ExpectedSequenceNode);

                        gffFormatter = new GffFormatter();
                        {
                            gffFormatter.Format(new Sequence(DnaAlphabet.Instance, sequenceData));
                        }                        
                        break;
                    case ArgumentNullExceptions.writeWithEmptySequence:

                        gffFormatter = new GffFormatter();
                        {
                            gffFormatter.Format(sequence);
                        }                                                                        
                        break;
                    case ArgumentNullExceptions.FormatString:

                        gffFormatter = new GffFormatter();
                        {
                            gffFormatter.FormatString(sequence);
                        }                                                
                        break;
                    case ArgumentNullExceptions.writeCollectionWithEmptyFile:
                        sequenceData = utilityObj.xmlUtil.GetTextValue(
                        Constants.SimpleGffDnaNodeName, Constants.ExpectedSequenceNode);
                        collection.Add(new Sequence(DnaAlphabet.Instance, sequenceData));

                        gffFormatter = new GffFormatter();
                        {
                            gffFormatter.Format(collection);
                        }                                                                                        
                        break;
                    case ArgumentNullExceptions.writeCollectionWithEmptySequence:

                        gffFormatter = new GffFormatter();
                        {
                            gffFormatter.Format(collection);
                        }                          
                        break;
                    default:
                        break;
                }

                Assert.Fail();
            }
           
            catch (ArgumentNullException)
            {                
                ApplicationLog.WriteLine("GFF P2 : Exception is validated successfully.");
            }
            catch (Exception)
            {
                ApplicationLog.WriteLine("GFF P2 : Exception is validated successfully.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// General method to invalidate Argument Null exceptions generated from different methods.
        /// </summary>
        /// <param name="nodeName">xml node name.</param>
        /// <param name="method">Gff Parse method parameters</param>
        void InvalidateGffWriteMethod(ArgumentNullExceptions method)
        {
            ISequence        sequence     = null;
            List <ISequence> collection   = new List <ISequence>();
            string           sequenceData = null;
            GffFormatter     gffFormatter = null;

            try
            {
                switch (method)
                {
                case ArgumentNullExceptions.writeWithEmptyFile:
                    sequenceData = utilityObj.xmlUtil.GetTextValue(
                        Constants.SimpleGffDnaNodeName, Constants.ExpectedSequenceNode);

                    gffFormatter = new GffFormatter();
                    {
                        gffFormatter.Format(new Sequence(DnaAlphabet.Instance, sequenceData));
                    }
                    break;

                case ArgumentNullExceptions.writeWithEmptySequence:

                    gffFormatter = new GffFormatter();
                    {
                        gffFormatter.Format(sequence);
                    }
                    break;

                case ArgumentNullExceptions.FormatString:

                    gffFormatter = new GffFormatter();
                    {
                        gffFormatter.FormatString(sequence);
                    }
                    break;

                case ArgumentNullExceptions.writeCollectionWithEmptyFile:
                    sequenceData = utilityObj.xmlUtil.GetTextValue(
                        Constants.SimpleGffDnaNodeName, Constants.ExpectedSequenceNode);
                    collection.Add(new Sequence(DnaAlphabet.Instance, sequenceData));

                    gffFormatter = new GffFormatter();
                    {
                        gffFormatter.Format(collection);
                    }
                    break;

                case ArgumentNullExceptions.writeCollectionWithEmptySequence:

                    gffFormatter = new GffFormatter();
                    {
                        gffFormatter.Format(collection);
                    }
                    break;

                default:
                    break;
                }

                Assert.Fail();
            }

            catch (ArgumentNullException)
            {
                ApplicationLog.WriteLine("GFF P2 : Exception is validated successfully.");
            }
            catch (Exception)
            {
                ApplicationLog.WriteLine("GFF P2 : Exception is validated successfully.");
            }
        }