예제 #1
0
        public void UpdateOrchestraTest()
        {
            Orchestra testOrchestra = Orchestra.GetOrchestraByID(-1);

            if (testOrchestra.IsNew)
            {
                testOrchestra.OrchestraID = -1;
            }
            testOrchestra.OrchestraName = "Adage";
            BsoArchiveEntities.Current.Save();

            var orchestraID    = Helper.CreateXElement(Constants.Orchestra.orchestraIDElement, "-1");
            var orchestraNotes = Helper.CreateXElement(Constants.Orchestra.orchestraNotesElement, "Test");
            var orchestraItem  = new System.Xml.Linq.XElement(Constants.Orchestra.orchestraElement, orchestraID, orchestraNotes);
            var eventItem      = new System.Xml.Linq.XElement(Constants.Event.eventElement, orchestraItem);
            var doc            = new System.Xml.Linq.XDocument(eventItem);

            Orchestra orchestra = Orchestra.NewOrchestra();

            orchestra.UpdateData(doc, "OrchestraNote", "eventOrchestraNotes");
            Assert.IsTrue(testOrchestra.OrchestraNote == "Test");

            BsoArchiveEntities.Current.DeleteObject(testOrchestra);
            BsoArchiveEntities.Current.DeleteObject(orchestra);
            BsoArchiveEntities.Current.Save();
        }