Пример #1
0
        public void ValidateEBIWuBlastManadatoryParams()
        {
            // Gets the search query parameter and their values.
            string querySequence = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.QuerySequency);
            string queryDatabaseValue = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.DatabaseValue);
            string queryProgramValue = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.ProgramValue);
            string queryDatabaseParameter = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.DatabaseParameter);
            string queryProgramParameter = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.ProgramParameter);
            string emailParameter = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.Emailparameter);
            string email = Utility._xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.EmailAdress);

            // Set Service confiruration parameters true.
            IBlastServiceHandler service          = new EbiWuBlastHandler();
            ConfigParameters     configParameters = new ConfigParameters();

            configParameters.UseBrowserProxy = true;
            service.Configuration            = configParameters;

            // Create search parameters object.
            BlastParameters ebiParams = new BlastParameters();

            // Add mandatory parameter values to search query parameters.
            //ebiParams.Add(querySequenceParameter, querySequence);
            ebiParams.Add(queryDatabaseParameter, queryDatabaseValue);
            ebiParams.Add(queryProgramParameter, queryProgramValue);
            ebiParams.Add(emailParameter, email);

            // Validate search query parameters.
            ParameterValidationResult validateParameters =
                EbiWuBlastHandler.ValidateParameters(ebiParams);
            bool result = validateParameters.IsValid;

            Assert.IsTrue(result);
            // Assert.IsTrue(ebiParams.Settings.ContainsValue(querySequence));
            Assert.IsTrue(ebiParams.Settings.ContainsValue(queryDatabaseValue));
            Assert.IsTrue(ebiParams.Settings.ContainsValue(queryProgramValue));
            Assert.IsTrue(ebiParams.Settings.ContainsValue(email));
            Assert.AreEqual(ebiParams.Settings.Count, 3);

            // Logs to the NUnit GUI (Console.Out) window
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Query Sequence{0} is as expected.", querySequence));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: DataBase Value{0} is as expected.", queryDatabaseValue));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Program Value {0} is as expected.", queryProgramValue));
        }
Пример #2
0
        public void ValidateEBIWuBlastManadatoryParams()
        {
            // Gets the search query parameter and their values.
            string querySequence = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.QuerySequency);
            string queryDatabaseValue = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.DatabaseValue);
            string queryProgramValue = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.ProgramValue);
            string queryDatabaseParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.DatabaseParameter);
            string queryProgramParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.ProgramParameter);
            string emailParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.Emailparameter);
            string email = utilityObj.xmlUtil.GetTextValue(
                Constants.BlastParametersNode, Constants.EmailAdress);
            string alphabetName = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.AlphabetNameNode);

            // Set Service confiruration parameters true.
            IBlastServiceHandler service = null;

            try
            {
                service = new EbiWuBlastHandler();
                ConfigParameters configParameters = new ConfigParameters();
                configParameters.UseBrowserProxy = true;
                service.Configuration            = configParameters;

                // Create search parameters object.
                BlastParameters ebiParams = new BlastParameters();

                // Add mandatory parameter values to search query parameters.
                //ebiParams.Add(querySequenceParameter, querySequence);
                ebiParams.Add(queryDatabaseParameter, queryDatabaseValue);
                ebiParams.Add(queryProgramParameter, queryProgramValue);
                ebiParams.Add(emailParameter, email);
                ebiParams.Add("SequenceType",
                              alphabetName.ToLower(CultureInfo.CurrentCulture).Replace("ambiguous", ""));

                // Validate search query parameters.
                ParameterValidationResult validateParameters =
                    EbiWuBlastHandler.ValidateParameters(ebiParams);
                bool result = validateParameters.IsValid;

                Assert.IsTrue(result);
                // Assert.IsTrue(ebiParams.Settings.ContainsValue(querySequence));
                Assert.IsTrue(ebiParams.Settings.ContainsValue(queryDatabaseValue));
                Assert.IsTrue(ebiParams.Settings.ContainsValue(queryProgramValue));
                Assert.IsTrue(ebiParams.Settings.ContainsValue(email));
                Assert.AreEqual(ebiParams.Settings.Count, 4);

                // Logs to the VSTest GUI (Console.Out) window
                Console.WriteLine(string.Format((IFormatProvider)null,
                                                "Ebi Blast BVT: Query Sequence{0} is as expected.", querySequence));
                Console.WriteLine(string.Format((IFormatProvider)null,
                                                "Ebi Blast BVT: DataBase Value{0} is as expected.", queryDatabaseValue));
                Console.WriteLine(string.Format((IFormatProvider)null,
                                                "Ebi Blast BVT: Program Value {0} is as expected.", queryProgramValue));
            }
            catch (Exception ex) { Assert.Fail(ex.Message); }
            finally
            {
                if (service != null)
                {
                    ((IDisposable)service).Dispose();
                }
            }
        }