Пример #1
0
        public virtual void GlobalTestSetup()
        {
            // Preconditions - ensure this setup is only called once
            DataStressErrors.Assert(string.IsNullOrEmpty(s_scenario), "Scenario was already set");
            DataStressErrors.Assert(s_source == null, "Source was already set");
            DataStressErrors.Assert(s_factory == null, "Factory was already set");

            // Set m_scenario
            string userProvidedScenario;

            TestMetrics.Overrides.TryGetValue("scenario", out userProvidedScenario);
            // Empty means default scenario for the test group
            s_scenario = (userProvidedScenario ?? string.Empty);
            s_scenario = s_scenario.ToUpperInvariant();

            // Set m_source
            // Empty means that test group will peek the default data source from the config file based on the scenario
            string userProvidedSourceName;

            if (TestMetrics.Overrides.TryGetValue("source", out userProvidedSourceName))
            {
                s_source = DataStressSettings.Instance.GetSourceByName(userProvidedSourceName);
            }

            // Set m_factory
            s_factory = CreateFactory(ref s_scenario, ref s_source);
            s_factory.InitializeSharedData(s_source);

            // Postconditions
            DataStressErrors.Assert(!string.IsNullOrEmpty(s_scenario), "Scenario was not set");
            DataStressErrors.Assert(s_source != null, "Source was not set");
            DataStressErrors.Assert(s_factory != null, "Factory was not set");
        }
Пример #2
0
 public virtual void GlobalTestCleanup()
 {
     s_factory.CleanupSharedData();
     s_source   = null;
     s_scenario = null;
     s_factory.Dispose();
     s_factory = null;
 }
Пример #3
0
 public virtual void GlobalTestCleanup()
 {
     s_factory.CleanupSharedData();
     s_source = null;
     s_scenario = null;
     s_factory.Dispose();
     s_factory = null;
 }
Пример #4
0
        public virtual void GlobalTestSetup()
        {
            // Preconditions - ensure this setup is only called once
            DataStressErrors.Assert(string.IsNullOrEmpty(s_scenario), "Scenario was already set");
            DataStressErrors.Assert(s_source == null, "Source was already set");
            DataStressErrors.Assert(s_factory == null, "Factory was already set");

            // Set m_scenario
            string userProvidedScenario;
            TestMetrics.Overrides.TryGetValue("scenario", out userProvidedScenario);
            // Empty means default scenario for the test group
            s_scenario = (userProvidedScenario ?? string.Empty);
            s_scenario = s_scenario.ToUpperInvariant();

            // Set m_source
            // Empty means that test group will peek the default data source from the config file based on the scenario
            string userProvidedSourceName;
            if (TestMetrics.Overrides.TryGetValue("source", out userProvidedSourceName))
            {
                s_source = DataStressSettings.Instance.GetSourceByName(userProvidedSourceName);
            }

            // Set m_factory
            s_factory = CreateFactory(ref s_scenario, ref s_source);
            s_factory.InitializeSharedData(s_source);

            // Postconditions
            DataStressErrors.Assert(!string.IsNullOrEmpty(s_scenario), "Scenario was not set");
            DataStressErrors.Assert(s_source != null, "Source was not set");
            DataStressErrors.Assert(s_factory != null, "Factory was not set");
        }