Beispiel #1
0
        [Assert_Editor][Test] public void Create_Delete_Libraries_with_a_GuidanceItem()
        {
            tmXmlDatabase.UsingFileStorage = true;                                  // need this since we are checking the file paths
            var originalName = "temp_lib_createLibraryWithGuidanceItemAndDelete";

            var libraryPath_OriginalName        = tmXmlDatabase.xmlDB_LibraryPath(originalName);
            var libraryPath_GuidanceItemsFolder = tmXmlDatabase.xmlDB_LibraryPath_GuidanceItems(originalName);

            Assert.IsNull(libraryPath_OriginalName, "libraryPath_OriginalName");
            Assert.IsNull(libraryPath_GuidanceItemsFolder, "libraryPath_GuidanceItemsFolder");

            //Create Library
            var newLibrary = tmWebServices.CreateLibrary(new Library {
                caption = originalName
            });

            libraryPath_OriginalName        = tmXmlDatabase.xmlDB_LibraryPath(originalName);
            libraryPath_GuidanceItemsFolder = tmXmlDatabase.xmlDB_LibraryPath_GuidanceItems(originalName);

            Assert.IsNotNull(newLibrary, "newLibrary");
            Assert.IsTrue(libraryPath_OriginalName.fileExists(), "libraryPath_originalName should exist after creation");
            Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should exists after library creation");


            //Create GuidanceItem
            var newGuidanceItem = new GuidanceItem_V3
            {
                libraryId = newLibrary.libraryId
            };
            var guidanceItem = tmWebServices.CreateGuidanceItem(newGuidanceItem);

            Assert.AreNotEqual(guidanceItem, Guid.Empty, "guidance Item was not created");
            Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should exist after library creation");


            //Delete Library
            var deleteResult = tmWebServices.DeleteLibrary(newLibrary.libraryId);

            Assert.IsTrue(deleteResult, "deleteResult");
            Assert.IsFalse(libraryPath_OriginalName.fileExists(), "libraryPath_originalName should not exist at the end");

            Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should not exist after delete");
            //tmXmlDatabase.UsingFileStorage = false;
        }
Beispiel #2
0
        public void Create_Delete_Libraries_with_a_GuidanceItem()
        {
            var originalName = "temp_lib_createLibraryWithGuidanceItemAndDelete";

            var libraryPath_originalName        = tmXmlDatabase.xmlDB_LibraryPath(originalName);
            var libraryPath_GuidanceItemsFolder = tmXmlDatabase.xmlDB_LibraryPath_GuidanceItems(originalName);

            //Files.deleteFile(libraryPath_originalName);  //temp while developing
            //Files.deleteFolder(libraryPath_GuidanceItemsFolder,true);

            Assert.IsFalse(libraryPath_originalName.fileExists(), "libraryPath_originalName should not exists");
            Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should not exists");

            //Create Library
            var newLibrary = tmWebServices.CreateLibrary(new Library()
            {
                caption = originalName
            });

            Assert.IsTrue(libraryPath_originalName.fileExists(), "libraryPath_originalName should exist after creation");
            Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should not exists after library creation");


            //Create GuidanceItem
            var newGuidanceItem = new GuidanceItem_V3()
            {
                libraryId = newLibrary.libraryId
            };
            var guidanceItem = tmWebServices.CreateGuidanceItem(newGuidanceItem);

            Assert.AreNotEqual(guidanceItem, Guid.Empty, "guidance Item was not created");
            Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should exist after library creation");


            //Delete Library
            var deleteResult = tmWebServices.DeleteLibrary(newLibrary.libraryId);

            Assert.IsTrue(deleteResult, "deleteResult");
            Assert.IsFalse(libraryPath_originalName.fileExists(), "libraryPath_originalName should not exist at the end");

            Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should not exist after delete");
        }
Beispiel #3
0
        [Test][Assert_Admin] public void Create_Delete_Libraries_with_a_GuidanceItem()
        {
            UserGroup.Admin.assert();

            var originalName = "temp_lib".add_RandomLetters(3);

            //Create Library
            var newLibrary = tmWebServices.CreateLibrary(new Library {
                caption = originalName
            });
            var tmLibrary = tmXmlDatabase.tmLibrary(newLibrary.libraryId);
            var libraryPath_OriginalName        = tmFileStorage.xmlDB_Path_Library_XmlFile(tmLibrary);
            var libraryPath_GuidanceItemsFolder = tmFileStorage.xmlDB_Path_Library_RootFolder(tmLibrary);

            Assert.IsNotNull(newLibrary, "newLibrary");
            Assert.IsTrue(libraryPath_OriginalName.fileExists(), "libraryPath_originalName should exist after creation");
            Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should exists after library creation");


            //Create GuidanceItem
            var newGuidanceItem = new GuidanceItem_V3
            {
                libraryId = newLibrary.libraryId
            };
            var guidanceItem = tmWebServices.CreateGuidanceItem(newGuidanceItem);

            Assert.AreNotEqual(guidanceItem, Guid.Empty, "guidance Item was not created");
            Assert.IsTrue(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should exist after library creation");


            //Delete Library
            var deleteResult = tmWebServices.DeleteLibrary(newLibrary.libraryId);

            Assert.IsTrue(deleteResult, "deleteResult");
            Assert.IsFalse(libraryPath_OriginalName.fileExists(), "libraryPath_originalName should not exist at the end");

            Assert.IsFalse(libraryPath_GuidanceItemsFolder.dirExists(), "libraryPath_GuidanceItemsFolder should not exist after delete");
            //tmXmlDatabase.useFileStorage(false);

            UserGroup.None.assert();
        }
        public void create_Libraries_Backup()
        {
            var libraryName = "temp_lib_createAndBackup";
            var newLibrary  = tmWebServices.CreateLibrary(new Library()
            {
                caption = libraryName
            });

            Assert.That(newLibrary.notNull());
            var newGuidanceItem = new GuidanceItem_V3()
            {
                libraryId = newLibrary.libraryId
            };

            tmWebServices.CreateGuidanceItem(newGuidanceItem);
            var backupFile = tmXmlDatabase.xmlDB_Libraries_BackupLibrary(newLibrary.libraryId);

            Assert.IsTrue(backupFile.fileExists());
            var backedUpfiles = new zipUtils().getListOfFilesInZip(backupFile);

            Assert.AreEqual(backedUpfiles.size(), 2, "there should be two files backup-ed files");
            tmWebServices.DeleteLibrary(newLibrary.libraryId);
        }
        public static Article_WS add_Article(this Library_WS library, string title, string content, string technology, string phase, string type, string category)
        {
            var guidanceItem = new GuidanceItem_V3();
            guidanceItem.guidanceItemId = Guid.Empty;
            guidanceItem.title = title;
            guidanceItem.htmlContent = content;
            guidanceItem.technology = technology;
            guidanceItem.phase = phase;
            guidanceItem.rule_Type = type;
            guidanceItem.category = category;

            guidanceItem.libraryId = library.Id;

            var guid = library.tmWebServices.webServices.CreateGuidanceItem(guidanceItem);

            return guid.article(library);
        }
Beispiel #6
0
 /// <remarks/>
 public void UpdateGuidanceItemAsync(GuidanceItem_V3 guidanceItem, object userState) {
     if ((this.UpdateGuidanceItemOperationCompleted == null)) {
         this.UpdateGuidanceItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateGuidanceItemOperationCompleted);
     }
     this.InvokeAsync("UpdateGuidanceItem", new object[] {
                 guidanceItem}, this.UpdateGuidanceItemOperationCompleted, userState);
 }
Beispiel #7
0
 /// <remarks/>
 public void UpdateGuidanceItemAsync(GuidanceItem_V3 guidanceItem) {
     this.UpdateGuidanceItemAsync(guidanceItem, null);
 }
Beispiel #8
0
 /// <remarks/>
 public System.IAsyncResult BeginUpdateGuidanceItem(GuidanceItem_V3 guidanceItem, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("UpdateGuidanceItem", new object[] {
                 guidanceItem}, callback, asyncState);
 }
Beispiel #9
0
 public bool UpdateGuidanceItem(GuidanceItem_V3 guidanceItem) {
     object[] results = this.Invoke("UpdateGuidanceItem", new object[] {
                 guidanceItem});
     return ((bool)(results[0]));
 }
Beispiel #10
0
 /// <remarks/>
 public void CreateGuidanceItemAsync(GuidanceItem_V3 guidanceItem) {
     this.CreateGuidanceItemAsync(guidanceItem, null);
 }
Beispiel #11
0
 public System.Guid CreateGuidanceItem(GuidanceItem_V3 guidanceItem) {
     object[] results = this.Invoke("CreateGuidanceItem", new object[] {
                 guidanceItem});
     return ((System.Guid)(results[0]));
 }