コード例 #1
0
        /// <summary>
        /// Loads project information and validates it.
        /// </summary>
        /// <param name="rebindCallback">The callback to be called if the document must be rebound because the collection cannot be found or the id does not match.</param>
        private void LoadProjectInformation(Func <Uri> rebindCallback)
        {
            XDocument projectInformationDoc = this.LoadAndValidateDocument(Constants.ProjectInformationNamespace, ProjectInformationSchema);

            if (projectInformationDoc != null)
            {
                Uri    uri          = new Uri(projectInformationDoc.Descendants(this.projectXName).Single().Attribute(this.collectionUriXName).Value);
                string collectionId = projectInformationDoc.Descendants(this.projectXName).Single().Attribute(this.collectionIdXName).Value;
                string name         = projectInformationDoc.Descendants(this.projectXName).Single().Attribute(this.projectNameXName).Value;
                bool   rebound      = false;
                bool   done         = false;
                do
                {
                    this.teamProject = this.factory.CreateTeamProject(uri, name, null);
                    if (this.teamProject.TeamProjectInformation.CollectionId != new Guid(collectionId))
                    {
                        uri = rebindCallback();
                        if (uri != null)
                        {
                            rebound = true;
                        }
                        else
                        {
                            done = true;
                        }
                    }
                    else
                    {
                        done = true;
                    }
                }while (!done);

                this.queryAndLayoutManager = this.factory.CreateQueryAndLayoutManager(this.teamProject.FieldDefinitions);

                if (rebound)
                {
                    this.SaveTeamProject();
                }

                if (uri != null)
                {
                    this.IsConnected = true;
                }
            }
            else
            {
                this.IsConnected = false;
            }
        }
コード例 #2
0
        public void InitializeTest()
        {
            this.container = new UnityContainer();

            this.sut = new QueryAndLayoutManager(TestHelper.CreateMockFieldDefinitions(SystemIdReferenceName, SystemTitleReferenceName, SystemDescriptionReferenceName, SystemAreaReferenceName));
        }