Пример #1
0
        /// <summary>
        /// Constructor uses the default test suit name
        /// </summary>
        protected TestClassBase()
        {
            if (!suiteNameCache.ContainsKey(this.GetType()))
            {
                suiteNameCache[this.GetType()] = staticTestSuiteName;
            }

            //switch test site while test running
            testSuiteName = suiteNameCache[this.GetType()];
            testSite      = ProtocolTestsManager.GetTestSite(testSuiteName);
            ptfTestNotify = ProtocolTestsManager.GetProtocolTestNotify(testSuiteName);
        }
        /// <summary>
        /// Constructor uses the default test suit name
        /// </summary>
        protected TestClassBase()
        {
            IProtocolTestsManager manager = ProtocolTestsManagerFactory.TestsManager;

            if (!suiteNameCache.ContainsKey(this.GetType()))
            {
                suiteNameCache[this.GetType()] = staticTestSuiteName;
            }

            //switch test site while test running
            testSuiteName = suiteNameCache[this.GetType()];
            testSite      = manager.GetTestSite(testSuiteName);
            ptfTestNotify = manager.GetProtocolTestNotify(testSuiteName);
            if (testSite == null)
            {
                StringBuilder errorMsg = new StringBuilder();
                errorMsg.AppendFormat("Cannot get the test site {0}.", testSuiteName)
                .AppendLine()
                .Append("If you are running test suite from Visual Studio, please make sure that the TestSettings file is selected in TEST\\Test Settings menu.");
                throw new InvalidOperationException(errorMsg.ToString());
            }
        }
        /// <summary>
        /// Constructor uses the default test suit name
        /// </summary>
        protected TestClassBase()
        {
            IProtocolTestsManager manager = ProtocolTestsManagerFactory.TestsManager;

            if (!suiteNameCache.ContainsKey(this.GetType()))
            {
                suiteNameCache[this.GetType()] = staticTestSuiteName;
            }

            //switch test site while test running
            testSuiteName = suiteNameCache[this.GetType()];
            testSite = manager.GetTestSite(testSuiteName);
            ptfTestNotify = manager.GetProtocolTestNotify(testSuiteName);
            if (testSite == null)
            {
                StringBuilder errorMsg = new StringBuilder();
                errorMsg.AppendFormat("Cannot get the test site {0}.", testSuiteName)
                    .AppendLine()
                    .Append("If you are running test suite from Visual Studio, please make sure that the TestSettings file is selected in TEST\\Test Settings menu.");
                throw new InvalidOperationException(errorMsg.ToString());
            }
        }