Example #1
0
        public void InValidateSubSequenceWithComplimentOperator()
        {
            // Get Values from XML node.
            string sequence = utilityObj.xmlUtil.GetTextValue(
                Constants.InvalidLocationWithComplementOperatorNode,
                Constants.ExpectedSequence);
            string location = utilityObj.xmlUtil.GetTextValue(
                Constants.InvalidLocationWithComplementOperatorNode,
                Constants.Location);
            string alphabet = utilityObj.xmlUtil.GetTextValue(
                Constants.InvalidLocationWithComplementOperatorNode,
                Constants.AlphabetNameNode);

            // Create a sequence object.
            ISequence seqObj = new Sequence(Utility.GetAlphabet(alphabet),
                                            sequence);

            // Build a location.
            ILocationBuilder locBuilder  = new LocationBuilder();
            ILocation        loc         = locBuilder.GetLocation(location);
            LocationResolver locResolver = new LocationResolver();

            // Get sequence using location of the sequence with operator.
            try
            {
                loc.GetSubSequence(seqObj);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                LogExceptionMessage();
            }

            // Validate sub sequence exception for an invalid sequence.
            try
            {
                locResolver.GetSubSequence(loc, null);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                LogExceptionMessage();
            }

            // Validate GetSubSequence method with null location.
            try
            {
                locResolver.GetSubSequence(null, seqObj);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                LogExceptionMessage();
            }

            // Validate sub sequence exception for an invalid sequence.
            try
            {
                locResolver.GetSubSequence(loc, null, null);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                LogExceptionMessage();
            }

            // Validate GetSubSequence method with null location.
            try
            {
                locResolver.GetSubSequence(null, seqObj, null);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                LogExceptionMessage();
            }

            // Validate GetSubSequence method with null location.
            try
            {
                loc.GetSubSequence(null);
                Assert.Fail();
            }
            catch (ArgumentNullException)
            {
                ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                       "GenBankFeatures P2 : Validate the exception successfully"));
            }
        }