Пример #1
0
        public void InitializeTest()
        {
            this.container = new UnityContainer();

            this.mockWordDocument = new Mock <IWordDocument>();
            this.container.RegisterInstance <IWordDocument>(this.mockWordDocument.Object);

            this.mockWordDocument.Setup(doc => doc.ContentControlsInRange(It.IsAny <Microsoft.Office.Interop.Word.Range>()))
            .Returns(
                (Microsoft.Office.Interop.Word.Range r) =>
            {
                List <ContentControl> ans = new List <ContentControl>();
                foreach (ContentControl cc in r.ContentControls)
                {
                    ans.Add(cc);
                }

                return(ans);
            });

            this.sut = this.container.Resolve <TeamProjectDocumentVerifier>();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TeamProjectDocument"/> class.
        /// </summary>
        /// <param name="container">The unity container to use.</param>
        /// <param name="template">The team project template that contains the layout information.</param>
        /// <param name="formatter">The formatter to be used to format work items.</param>
        /// <param name="layoutDefinitionFormatter">The layout definition formatter to be used to show and edit layout definitions in the document.</param>
        /// <param name="verifier">The verifier to be used to verify the document structure.</param>
        /// <param name="factory">The factory used to create other objects.</param>
        /// <remarks>
        /// the code requires the <paramref name="wordDocument"/> parameter to have this exact name because of the way Unity does parameter overrides.
        /// </remarks>
        public TeamProjectDocument(IUnityContainer container, ITeamProjectTemplate template, ITeamProjectDocumentFormatter formatter, ILayoutDefinitionFormatter layoutDefinitionFormatter, ITeamProjectDocumentVerifier verifier, IFactory factory)
        {
            if (template == null)
            {
                throw new ArgumentNullException("template");
            }

            if (formatter == null)
            {
                throw new ArgumentNullException("formatter");
            }

            if (layoutDefinitionFormatter == null)
            {
                throw new ArgumentNullException("layoutDefinitionFormatter");
            }

            if (verifier == null)
            {
                throw new ArgumentNullException("verifier");
            }

            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            this.container = container;
            this.loaded    = false;
            this.template  = template;
            this.formatter = formatter;
            this.layoutDefinitionFormatter = layoutDefinitionFormatter;
            this.verifier = verifier;
            this.factory  = factory;

            XNamespace nsp = Constants.ProjectInformationNamespace;

            this.projectXName       = nsp + "Project";
            this.collectionUriXName = "CollectionUri";
            this.collectionIdXName  = "CollectionId";
            this.projectNameXName   = "ProjectName";

            XNamespace nsq = Constants.QueryNamespace;

            this.queriesAndLayoutsXName = nsq + "QueriesAndLayouts";
            this.queryAndLayoutXName    = nsq + "QueryAndLayout";
            this.queryXName             = nsq + "Query";
            this.layoutNameXName        = nsq + "LayoutName";

            XNamespace nsw = Constants.WorkItemNamespace;

            this.workItemsXName = nsw + "WorkItems";
            this.workItemXName  = nsw + "WorkItem";

            XNamespace nsqw = Constants.QueryWorkItemNamespace;

            this.queryWorkItemAssociationQueryXName = nsqw + "Query";
            this.queryWorkItemAssociationIdXName    = nsqw + "WorkItem";

            this.workItemManager = new WorkItemManager();
            this.queryWorkItems  = new List <QueryWorkItems>();

            ILogger logger = this.container.Resolve <ILogger>();

            logger.Log(TraceEventType.Verbose, "Creating a new Team Project Document");
        }