Ejemplo n.º 1
0
        public override void Initialize()
        {
            m_currentDirectory = Directory.GetCurrentDirectory();
            base.Initialize();

            TCAdapterEnvironment sourceTCAdapterEnv = TestEnvironment.SourceTCAdapterEnvironment;
            TCAdapterEnvironment targetTCAdapterEnv = TestEnvironment.TargetTCAdapterEnvironment;

            m_sourceAdapter = (IVCTestCaseAdapter)TestAdapterManager.LoadAdapter(new Guid(TestEnvironment.SourceTCAdapterEnvironment.AdapterRefName));
            m_targetAdapter = (IVCTestCaseAdapter)TestAdapterManager.LoadAdapter(new Guid(TestEnvironment.TargetTCAdapterEnvironment.AdapterRefName));

            m_sourceAdapter.Initialize(sourceTCAdapterEnv);
            m_targetAdapter.Initialize(targetTCAdapterEnv);

            MappingPair mapping = new MappingPair(m_sourceAdapter.FilterString, m_targetAdapter.FilterString);

            TestEnvironment.AddMapping(mapping);

            TestEnvironment.SourceWorkspaceLocalPath = m_sourceAdapter.WorkspaceLocalPath;
            TestEnvironment.TargetWorkspaceLocalPath = m_targetAdapter.WorkspaceLocalPath;

            // an extra file is usefull to make sure that the toolkit was not left in a bad state after migrating the scenario under test
            m_extraFile = new MigrationItemStrings("extraFile.txt", null, TestEnvironment, true);
            Trace.TraceInformation("Adding an extra file {0} -> {1}", m_extraFile.LocalPath, m_extraFile.ServerPath);

            SourceAdapter.AddFile(m_extraFile.LocalPath);

            InitializeTestCase();

            Trace.TraceInformation("Loaded VC test environment successfully");
        }
Ejemplo n.º 2
0
        // Build filter string based on work item ids
        protected void BuildFilterStringPair()
        {
            string sourceFilterString = String.Format("{0}", SourceAdapter.TitleQuery);
            string targetFilterString = String.Format("{0}", TargetAdapter.TitleQuery);

            Trace.TraceInformation("sourceFilterString = '{0}", sourceFilterString);
            Trace.TraceInformation("targetFilterString = '{0}", targetFilterString);
            MappingPair mapping = new MappingPair(sourceFilterString, targetFilterString);

            TestEnvironment.AddMapping(mapping);
        }
Ejemplo n.º 3
0
        // Build filter string based on work item ids
        protected void BuildFilterStringPair()
        {
            StringBuilder filter1 = new StringBuilder();

            if (m_sourceWorkItemIds.Count > 5)
            {
                int firstId = m_sourceWorkItemIds[0];
                int lastId  = m_sourceWorkItemIds[m_sourceWorkItemIds.Count - 1];
                filter1.AppendFormat("{0} >= {1} AND {2} <= {3}",
                                     SourceAdapter.WorkItemIDColumnName, firstId, SourceAdapter.WorkItemIDColumnName, lastId);
            }
            else
            {
                for (int i = 0; i < m_sourceWorkItemIds.Count; i++)
                {
                    filter1.AppendFormat("{0} = {1}", SourceAdapter.WorkItemIDColumnName, m_sourceWorkItemIds[i]);

                    if (i < m_sourceWorkItemIds.Count - 1)
                    {
                        filter1.Append(" OR ");
                    }
                }
            }

            StringBuilder filter2 = new StringBuilder();

            if (m_targetWorkItemIds.Count > 5)
            {
                int firstId = m_targetWorkItemIds[0];
                int lastId  = m_targetWorkItemIds[m_targetWorkItemIds.Count - 1];
                filter2.AppendFormat("{0} >= {1} AND {2} <= {3}",
                                     TargetAdapter.WorkItemIDColumnName, firstId, TargetAdapter.WorkItemIDColumnName, lastId);
            }
            else
            {
                for (int i = 0; i < m_targetWorkItemIds.Count; i++)
                {
                    filter2.AppendFormat("{0} = {1}", TargetAdapter.WorkItemIDColumnName, m_targetWorkItemIds[i]);

                    if (i < m_targetWorkItemIds.Count - 1)
                    {
                        filter2.Append(" OR ");
                    }
                }
            }

            string filterString1 = filter1.ToString();
            string filterString2 = filter2.ToString();

            if (string.IsNullOrEmpty(filterString1))
            {
                filterString1 = string.Format("{0} = 0", SourceAdapter.WorkItemIDColumnName);
            }

            if (string.IsNullOrEmpty(filterString2))
            {
                filterString2 = string.Format("{0} = 0", TargetAdapter.WorkItemIDColumnName);
            }

            if (!string.IsNullOrEmpty(SourceAdapter.FilterString))
            {
                filterString1 = SourceAdapter.FilterString + filterString1;
            }

            if (!string.IsNullOrEmpty(TargetAdapter.FilterString))
            {
                filterString1 = TargetAdapter.FilterString + filterString1;
            }

            MappingPair mapping = new MappingPair(filterString1, filterString2);

            TestEnvironment.AddMapping(mapping);
        }
Ejemplo n.º 4
0
 public void AddMapping(MappingPair mapping)
 {
     Mappings.Add(mapping);
 }