Пример #1
0
        public void DownloadAllProperties()
        {
            // Clean up any previous data
            SampleData.DeleteTestGroups();
            SampleData.CreateEverything();

            string outputTaxmlString = FunctionalTests.DownloadTestDataAsTaxml(this.connector);

            this.AssertXmlMatchesResource(outputTaxmlString, "Output");
        }
Пример #2
0
        public void DownloadWithCsomTrace()
        {
            // Clean up any previous data
            SampleData.DeleteTestGroups();

            SampleData.CreateMinimal();

            ClientTestConnectorHook.ResetClientRequestSequenceId();
            using (var hook = new ClientTestConnectorHook(this.connector))
            {
                string outputTaxmlString = FunctionalTests.DownloadTestDataAsTaxml(this.connector);
                this.AssertXmlMatchesResource(outputTaxmlString, "Output");

                this.AssertXmlMatchesResource(hook.GetCsomRequestsAsXml(), "CsomRequests");
                Debug.WriteLine(hook.CsomRequests.Count);
            }
        }
Пример #3
0
        private void DoCreateUpdateModify(string testGroupName)
        {
            // Clean up any previous data
            SampleData.DeleteTestGroups();

            var options = new ClientConnectorUploadOptions();

            // options.MaximumBatchSize = 1;

            //---------------------------------------------------------------
            // Initial creation of the objects
            Debug.WriteLine("Part 1: Upload that initially creates objects");

            string         initialInputTaxml = this.GetTestResource("InitialInput", testGroupName);
            LocalTermStore initialTermStore  = TaxmlLoader.LoadFromString(initialInputTaxml);

            initialTermStore.SyncAction = new SyncAction()
            {
                IfMissing   = SyncActionIfMissing.Create,
                IfPresent   = SyncActionIfPresent.Error,
                IfElsewhere = SyncActionIfElsewhere.Error
            };
            this.connector.Upload(initialTermStore, SampleData.TermStoreId, options);

            string initialOutputTaxml = FunctionalTests.DownloadTestDataAsTaxml(this.connector);

            this.AssertXmlMatchesResource(initialOutputTaxml, "InitialOutput", testGroupName);

            //---------------------------------------------------------------
            // Perform a second upload of the exact same content, to verify that
            // no changes were committed to the term store
            Debug.WriteLine("Part 2: Duplicate upload that doesn't change anything");

            initialTermStore.SyncAction = new SyncAction()
            {
                IfMissing   = SyncActionIfMissing.Error,
                IfPresent   = SyncActionIfPresent.Update,
                IfElsewhere = SyncActionIfElsewhere.Error
            };

            DateTime changeTimeBefore = this.GetChangeTimeForTermStore();

            this.connector.Upload(initialTermStore, SampleData.TermStoreId, options);
            DateTime changeTimeAfter = this.GetChangeTimeForTermStore();

            Assert.AreEqual(changeTimeAfter, changeTimeBefore);

            //---------------------------------------------------------------
            // Upload a modified input that changes every property
            Debug.WriteLine("Part 3: Upload that makes modifications");

            string         modifiedInputTaxml = this.GetTestResource("ModifiedInput", testGroupName);
            LocalTermStore modifiedTermStore  = TaxmlLoader.LoadFromString(modifiedInputTaxml);

            modifiedTermStore.SyncAction = new SyncAction()
            {
                IfMissing   = SyncActionIfMissing.Error,
                IfPresent   = SyncActionIfPresent.Update,
                IfElsewhere = SyncActionIfElsewhere.Error
            };
            this.connector.Upload(modifiedTermStore, SampleData.TermStoreId, options);

            string modifiedOutputTaxml = FunctionalTests.DownloadTestDataAsTaxml(this.connector);

            this.AssertXmlMatchesResource(modifiedOutputTaxml, "ModifiedOutput", testGroupName);
        }