public void DataService_AddHeirarchicalTerm_Adds_First_Record_On_Valid_Term()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, addHeirarchicalTerm);

            Term term = new Term(4)
                            {
                                Name = "Test Term",
                                ParentTermId = null /*No Parent*/,
                                Weight = 0,
                                Description = "Test Term"
                            };

            DataService ds = new DataService();

            //Act
            int newTermId = ds.AddHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount + 1);
            DatabaseAssert.RecordLastAddedIdEquals(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                                   "TermID", newTermId);

            //Assert that new term is correct as first record in Vocabulary
            TestTerm(newTermId, 1, 2);
        }
Ejemplo n.º 2
0
        public void BindTerm(Term term, IEnumerable<Term> terms, bool isHeirarchical, bool loadFromControl, bool editEnabled)
        {
            //nameValidator.Text = Services.Localization.Localization.GetString("TermName.Required", SharedResourceFile);

            if (loadFromControl)
            {
                term.Name = nameTextBox.Text;
                term.Description = descriptionTextBox.Text;
                if (isHeirarchical && !string.IsNullOrEmpty(parentTermCombo.SelectedValue))
                {
                    term.ParentTermId = Int32.Parse(parentTermCombo.SelectedValue);
                }
            }
            else
            {
                nameTextBox.Text = term.Name;
                descriptionTextBox.Text = term.Description;

                //Remove this term (and its descendants) from the collection, so we don't get wierd heirarchies
                var termsList = (from t in terms where !(t.Left >= term.Left && t.Right <= term.Right) select t).ToList();

                parentTermCombo.DataSource = termsList;
                parentTermCombo.DataBind();

                if (term.ParentTermId.HasValue && parentTermCombo.FindItemByValue(term.ParentTermId.ToString()) != null)
                {
                    parentTermCombo.FindItemByValue(term.ParentTermId.ToString()).Selected = true;
                }

                divParentTerm.Visible = isHeirarchical && termsList.Count > 0;
                nameTextBox.Enabled = editEnabled;
                descriptionTextBox.Enabled = editEnabled;
                parentTermCombo.Enabled = editEnabled;
            }
        }
Ejemplo n.º 3
0
 internal static Term CreateValidSimpleTerm(int vocabularyId)
 {
     Term term = new Term(vocabularyId)
                     {
                         Name = Constants.TERM_ValidName,
                         Description = Constants.TERM_ValidName,
                         Weight = Constants.TERM_ValidWeight
                     };
     return term;
 }
Ejemplo n.º 4
0
 internal static Term CreateValidHeirarchicalTerm(int vocabularyId, int parentId)
 {
     Term term = new Term(vocabularyId)
                     {
                         Name = Constants.TERM_ValidName,
                         Description = Constants.TERM_ValidName,
                         Weight = Constants.TERM_ValidWeight,
                         ParentTermId = parentId
                     };
     return term;
 }
Ejemplo n.º 5
0
        public void BindTerm(Term term, IEnumerable<Term> terms, bool isHeirarchical, bool loadFromControl, bool editEnabled)
        {
            //nameValidator.Text = Services.Localization.Localization.GetString("TermName.Required", SharedResourceFile);

            if (loadFromControl)
            {
                term.Name = nameTextBox.Text;
                term.Description = descriptionTextBox.Text;
                if (isHeirarchical && !string.IsNullOrEmpty(parentTermCombo.SelectedValue))
                {
                    term.ParentTermId = Int32.Parse(parentTermCombo.SelectedValue);
                }
            }
            else
            {
                nameTextBox.Text = term.Name;
				nameTextBox.Attributes.Add("data-termid", term.TermId.ToString());
				nameTextBox.Attributes.Add("data-vocabularyid", term.VocabularyId.ToString());
                descriptionTextBox.Text = term.Description;

                //Remove this term (and its descendants) from the collection, so we don't get wierd heirarchies
                var termsList = (from t in terms where !(t.Left >= term.Left && t.Right <= term.Right) select t).ToList();
				parentTermCombo.Items.Clear();
	            foreach (var t in termsList)
	            {
		            var item = new DnnComboBoxItem(t.Name, t.TermId.ToString());
					if (term.ParentTermId.HasValue && term.ParentTermId == t.TermId)
					{
						item.Selected = true;
					}
					parentTermCombo.Items.Add(item);
	            }

                divParentTerm.Visible = isHeirarchical && termsList.Count > 0;
                nameTextBox.Enabled = editEnabled;
                descriptionTextBox.Enabled = editEnabled;
                parentTermCombo.Enabled = editEnabled;
            }
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Adds the heirarchical term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <param name="createdByUserId">The created by user id.</param>
		/// <returns>term id.</returns>
        public int AddHeirarchicalTerm(Term term, int createdByUserId)
        {
            return _provider.ExecuteScalar<int>("AddHeirarchicalTerm", term.VocabularyId, term.ParentTermId, term.Name, term.Description, term.Weight, createdByUserId);
        }
Ejemplo n.º 7
0
 private void LoadCategoryList()
 {
     ITermController termController = Util.GetTermController();
     var terms = termController.GetTermsByVocabulary("Module_Categories").OrderBy(t => t.Weight).Where(t => t.Name != "< None >").ToList();
     var allTerm = new Term("All", Localization.GetString("AllCategories", LocalResourceFile));
     terms.Add(allTerm);
     CategoryList.DataSource = terms;
     CategoryList.DataBind();
     if (!IsPostBack)
     {
         CategoryList.Select("All", false);
     }
 }
Ejemplo n.º 8
0
        private void SaveTags()
        {
            string tags = new PortalSecurity().InputFilter(_Tags, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting);
            tags = HttpContext.Current.Server.HtmlEncode(tags);
            if (!string.IsNullOrEmpty(tags))
            {
                foreach (string t in tags.Split(','))
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        string tagName = t.Trim(' ');
                        Term existingTerm = (from term in ContentItem.Terms.AsQueryable() where term.Name.Equals(tagName, StringComparison.CurrentCultureIgnoreCase) select term).SingleOrDefault();

                        if (existingTerm == null)
                        {
                            //Not tagged
                            TermController termController = new TermController();
                            Term term =
                                (from te in termController.GetTermsByVocabulary(TagVocabulary.VocabularyId) where te.Name.Equals(tagName, StringComparison.CurrentCultureIgnoreCase) select te).
                                    SingleOrDefault();
                            if (term == null)
                            {
                                //Add term
                                term = new Term(TagVocabulary.VocabularyId);
                                term.Name = tagName;
                                termController.AddTerm(term);
                            }

                            //Add term to content
                            ContentItem.Terms.Add(term);
                            termController.AddTermToContent(term, ContentItem);
                        }
                    }
                }
            }

            IsEditMode = false;

            //Raise the Tags Updated Event
            OnTagsUpdate(EventArgs.Empty);
        }
Ejemplo n.º 9
0
        private void RenderTerm(HtmlTextWriter writer, Term term, bool renderSeparator)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format(NavigateUrlFormatString, term.Name));
            writer.AddAttribute(HtmlTextWriterAttribute.Title, term.Name);
            writer.AddAttribute(HtmlTextWriterAttribute.Rel, "tag");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write(term.Name);
            writer.RenderEndTag();

            if (renderSeparator)
            {
                writer.Write(Separator);
            }
        }
        public void DataService_UpdateHeirarchicalTerm_Updates_Record_But_Does_Not_Modify_Other_Terms_If_ParentID_Does_Not_Change()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, updateHeirarchicalTerm);

            Term term = new Term(4)
                            {
                                TermId = 17,
                                Name = "Test Update",
                                ParentTermId = null,
                                Weight = 0,
                                Description = "Updated"
                            };

            DataService ds = new DataService();

            //Act
            ds.UpdateHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount);

            //Assert that electronics terms are untouched
            //Televisions, Id = 1, Left=12, Right=17
            TestTerm(1, 12, 17);
            //Flash, Id = 9, Left=8, Right=9
            TestTerm(9, 8, 9);
            //Electronics, Id = 12, Left=1, Right=18
            TestTerm(12, 1, 18);
        }
Ejemplo n.º 11
0
		/// <summary>
		/// Updates the simple term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <param name="lastModifiedByUserId">The last modified by user id.</param>
        public void UpdateSimpleTerm(Term term, int lastModifiedByUserId)
        {
            _provider.ExecuteNonQuery("UpdateSimpleTerm", term.TermId, term.VocabularyId, term.Name, term.Description, term.Weight, lastModifiedByUserId);
        }
Ejemplo n.º 12
0
		/// <summary>
		/// Deletes the simple term.
		/// </summary>
		/// <param name="term">The term.</param>
        public void DeleteSimpleTerm(Term term)
        {
            _provider.ExecuteNonQuery("DeleteSimpleTerm", term.TermId);
        }
Ejemplo n.º 13
0
        public IQueryable<ContentItem> GetContentItemsByTerm(Term term)
	    {
	        return GetContentItemsByTerm(term.Name);
	    }
Ejemplo n.º 14
0
 public TermsEventArgs(Term selectedTerm)
 {
     _SelectedTerm = selectedTerm;
 }
Ejemplo n.º 15
0
        public static void AddModuleCategory(string category)
        {
            var termController = Util.GetTermController();
            var term = (from Term t in termController.GetTermsByVocabulary("Module_Categories")
                        where t.Name == category
                        select t)
                        .FirstOrDefault();

            if (term == null)
            {
                var vocabularyController = Util.GetVocabularyController();
                var vocabulary = (from v in vocabularyController.GetVocabularies()
                                  where v.Name == "Module_Categories"
                                  select v)
                                  .FirstOrDefault();

                if (vocabulary != null)
                {
                    term = new Term(vocabulary.VocabularyId) { Name = category };

                    termController.AddTerm(term);
                }
            }
        }
Ejemplo n.º 16
0
		/// <summary>
		/// Updates the term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <exception cref="System.ArgumentNullException">term is null.</exception>
		/// <exception cref="System.ArgumentOutOfRangeException">term.TermId is less than 0.</exception>
		/// <exception cref="System.ArgumentOutOfRangeException">term.VocabularyId is less than 0.</exception>
		/// <exception cref="System.ArgumentException">term.Name is empty.</exception>
        public void UpdateTerm(Term term)
        {
            //Argument Contract
            Requires.NotNull("term", term);
            Requires.PropertyNotNegative("term", "TermId", term.TermId);
            Requires.PropertyNotNegative("term", "Vocabulary.VocabularyId", term.VocabularyId);
            Requires.PropertyNotNullOrEmpty("term", "Name", term.Name);

            if ((term.IsHeirarchical))
            {
                _DataService.UpdateHeirarchicalTerm(term, UserController.Instance.GetCurrentUserInfo().UserID);
            }
            else
            {
                _DataService.UpdateSimpleTerm(term, UserController.Instance.GetCurrentUserInfo().UserID);
            }

            //Clear Cache
            DataCache.RemoveCache(string.Format(_CacheKey, term.VocabularyId));
        }
        public void DataService_AddHeirarchicalTerm_Does_Not_Modify_Terms_From_Other_Vocabularies()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, addHeirarchicalTerm);

            Term term = new Term(4)
                            {
                                Name = "Test Term",
                                ParentTermId = null /*No Parent*/,
                                Weight = 0,
                                Description = "Test Term"
                            };

            DataService ds = new DataService();

            //Act
            int newTermId = ds.AddHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert that electronics terms are untouched
            //Televisions, Id = 1, Left=12, Right=17
            TestTerm(1, 12, 17);
            //Flash, Id = 9, Left=8, Right=9
            TestTerm(9, 8, 9);
            //Electronics, Id = 12, Left=1, Right=18
            TestTerm(12, 1, 18);
        }
        public void DataService_DeleteHeirarchicalTerm_Does_Not_Modify_Terms_From_Other_Vocabularies()
        {
            //Arrange
            DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteHeirarchicalTerm);

            Term term = new Term(3)
                            {
                                TermId = 16,
                                Name = "Test Delete",
                                ParentTermId = null,
                                Weight = 0,
                                Description = "Test Delete"
                            };

            DataService ds = new DataService();

            //Act
            ds.DeleteHeirarchicalTerm(term);

            //Assert that electronics terms are untouched
            //Televisions, Id = 1, Left=12, Right=17
            TestTerm(1, 12, 17);
            //Flash, Id = 9, Left=8, Right=9
            TestTerm(9, 8, 9);
            //Electronics, Id = 12, Left=1, Right=18
            TestTerm(12, 1, 18);
        }
Ejemplo n.º 19
0
		/// <summary>
		/// Adds the simple term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <param name="createdByUserId">The created by user id.</param>
		/// <returns>term id.</returns>
        public int AddSimpleTerm(Term term, int createdByUserId)
        {
            return _provider.ExecuteScalar<int>("AddSimpleTerm", term.VocabularyId, term.Name, term.Description, term.Weight, createdByUserId);
        }
        public void DataService_DeleteHeirarchicalTerm_Delete_Record_On_Valid_Term()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, deleteHeirarchicalTerm);

            int termId = 7;
            Term term = new Term(2)
                            {
                                TermId = 7,
                                Name = "CD Players",
                                ParentTermId = 2 /*Portable Electronics*/,
                                Weight = 0,
                                Description = "CD Players"
                            };

            DataService ds = new DataService();

            //Act
            ds.DeleteHeirarchicalTerm(term);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount - 1);
            DatabaseAssert.RecordDoesNotExist(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              keyField, termId.ToString());

            //Assert that existing terms are correct
            //Televisions, Id = 1, Left=12, Right=17 - should be Left=10, Right=15
            TestTerm(1, 10, 15);
            //2-Way, Id = 8, Left=3, Right=4 - should be Left=3, Right=4
            TestTerm(8, 3, 4);
            //Electronics, Id = 12, Left=1, Right=18 - should be Left=1, Right=16
            TestTerm(12, 1, 16);
        }
Ejemplo n.º 21
0
 public void AddTermToContent(Term term, ContentItem contentItem)
 {
     _provider.ExecuteNonQuery("AddTermToContent", term.TermId, contentItem.ContentItemId);
 }
Ejemplo n.º 22
0
        public void TermController_DeleteTerm_Clears_Term_Cache_On_Valid_Term()
        {
            //Arrange
            Mock<IDataService> mockDataService = new Mock<IDataService>();
            TermController termController = new TermController(mockDataService.Object);

            Term term = new Term(Constants.VOCABULARY_ValidVocabularyId) {TermId = Constants.TERM_DeleteTermId};

            //Act
            termController.DeleteTerm(term);

            //Assert
            mockCache.Verify(
                cache => cache.Remove(String.Format(Constants.TERM_CacheKey, Constants.VOCABULARY_ValidVocabularyId)));
        }
Ejemplo n.º 23
0
		/// <summary>
		/// Deletes the heirarchical term.
		/// </summary>
		/// <param name="term">The term.</param>
        public void DeleteHeirarchicalTerm(Term term)
        {
            _provider.ExecuteNonQuery("DeleteHeirarchicalTerm", term.TermId);
        }
        public void DataService_AddHeirarchicalTerm_Inserts_Record_In_Alpha_Order_On_Valid_Term()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, addHeirarchicalTerm);

            Term term = new Term(2)
                            {
                                Name = "Plasma",
                                ParentTermId = 1 /*Televisions*/,
                                Weight = 0,
                                Description = "Plasma"
                            };

            DataService ds = new DataService();

            //Act
            int newTermId = ds.AddHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount + 1);
            DatabaseAssert.RecordLastAddedIdEquals(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                                   "TermID", newTermId);

            //Assert that new term is correct as middle child of televisions
            TestTerm(newTermId, 15, 16);

            //Assert that existing terms are correct
            //Televisions, Id = 1, Left=12, Right=17 - should be Left=12, Right=19
            TestTerm(1, 12, 19);
            //Flash, Id = 9, Left=8, Right=9 - should be Left=8, Right=9
            TestTerm(9, 8, 9);
            //Electronics, Id = 12, Left=1, Right=18 - should be Left=1, Right=20
            TestTerm(12, 1, 20);
        }
Ejemplo n.º 25
0
		/// <summary>
		/// Adds the content of the term to.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <param name="contentItem">The content item.</param>
		/// <exception cref="System.ArgumentNullException">term is null.</exception>
		/// <exception cref="System.ArgumentNullException">content item is null.</exception>
        public void AddTermToContent(Term term, ContentItem contentItem)
        {
            //Argument Contract
            Requires.NotNull("term", term);
            Requires.NotNull("contentItem", contentItem);

            _DataService.AddTermToContent(term, contentItem);
        }
        public void DataService_UpdateHeirarchicalTerm_Updates_Records_On_Change_Parent_To_Sibling_Of_Parent()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, updateHeirarchicalTerm);

            Term term = new Term(2)
                            {
                                TermId = 6,
                                Name = "MP3 Players",
                                ParentTermId = 12 /*Electronics*/,
                                Weight = 0,
                                Description = "MP3 Players"
                            };

            DataService ds = new DataService();

            //Act
            ds.UpdateHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount);

            //Assert that existing terms are correct
            //Televisions, Id = 1, Left=12, Right=17 - should be Left=12, Right=17
            TestTerm(1, 12, 17);
            //2-Way, Id = 8, Left=3, Right=4 - should be Left=7, Right=8
            TestTerm(8, 7, 8);
            //Electronics, Id = 12, Left=1, Right=18 - should be Left=1, Right=18
            TestTerm(12, 1, 18);
            //MP3 Players, Id = 6, Left=7, Right=10 - should be Left=2, Right=5
            TestTerm(6, 2, 5);
            //Flash Players, Id = 9, Left=8, Right=9 - should be Left=3, Right=4
            TestTerm(9, 3, 4);
        }
Ejemplo n.º 27
0
		/// <summary>
		/// Deletes the term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <exception cref="System.ArgumentNullException">term is null.</exception>
		/// <exception cref="System.ArgumentOutOfRangeException">term.TermId is less than 0.</exception>
        public void DeleteTerm(Term term)
        {
            //Argument Contract
            Requires.NotNull("term", term);
            Requires.PropertyNotNegative("term", "TermId", term.TermId);

            if ((term.IsHeirarchical))
            {
                _DataService.DeleteHeirarchicalTerm(term);
            }
            else
            {
                _DataService.DeleteSimpleTerm(term);
            }

            //Clear Cache
            DataCache.RemoveCache(string.Format(_CacheKey, term.VocabularyId));
        }
Ejemplo n.º 28
0
		/// <summary>
		/// Adds the term.
		/// </summary>
		/// <param name="term">The term.</param>
		/// <returns>term id.</returns>
		/// <exception cref="System.ArgumentNullException">term is null.</exception>
		/// <exception cref="System.ArgumentOutOfRangeException">term.VocabularyId is less than 0.</exception>
		/// <exception cref="System.ArgumentException">term.Name is empty.</exception>
        public int AddTerm(Term term)
        {
            //Argument Contract
            Requires.NotNull("term", term);
            Requires.PropertyNotNegative("term", "VocabularyId", term.VocabularyId);
            Requires.PropertyNotNullOrEmpty("term", "Name", term.Name);

            if ((term.IsHeirarchical))
            {
                term.TermId = _DataService.AddHeirarchicalTerm(term, UserController.GetCurrentUserInfo().UserID);
            }
            else
            {
                term.TermId = _DataService.AddSimpleTerm(term, UserController.GetCurrentUserInfo().UserID);
            }

            //Clear Cache
            DataCache.RemoveCache(string.Format(_CacheKey, term.VocabularyId));

            return term.TermId;
        }
Ejemplo n.º 29
0
        private static void ImportDocumentLibraryCategoryAssoc(ContentType fileContentType)
        {
            DataProvider dataProvider = DataProvider.Instance();
            IDataReader dr;
            try
            {
                dr = dataProvider.ExecuteReader("ImportDocumentLibraryCategoryAssoc");
                var termController = new TermController();
                var vocabulary = new VocabularyController().GetVocabularies().Single(v => v.Name == "Tags");
                var terms = termController.GetTermsByVocabulary(vocabulary.VocabularyId);

                while (dr.Read())
                {
                    var file = FileManager.Instance.GetFile((int)dr["FileId"]);
                    ContentItem attachContentItem;
                    if (file.ContentItemID == Null.NullInteger)
                    {
                        attachContentItem = CreateFileContentItem();
                        file.ContentItemID = attachContentItem.ContentItemId;
                        FileManager.Instance.UpdateFile(file);
                    }
                    else
                    {
                        attachContentItem = Util.GetContentController().GetContentItem(file.ContentItemID);
                    }

                    var term = terms.SingleOrDefault(t => t.Name == dr["CategoryName"].ToString());
                    if (term == null)
                    {
                        term = new Term(dr["CategoryName"].ToString(), null, vocabulary.VocabularyId);
                        termController.AddTerm(term);
                    }
                    termController.AddTermToContent(term, attachContentItem);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
        public void DataService_AddHeirarchicalTerm_Inserts_Record_As_First_Child_On_Valid_Term()
        {
            //Arrange
            int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName);
            DataUtil.AddDatabaseObject(virtualScriptFilePath, addHeirarchicalTerm);

            Term term = new Term(2)
                            {
                                Name = "Game Console",
                                ParentTermId = 12 /*Electronics*/,
                                Weight = 0,
                                Description = "Game Consoles like X-Box 360"
                            };

            DataService ds = new DataService();

            //Act
            int newTermId = ds.AddHeirarchicalTerm(term, Constants.USER_ValidId);

            //Assert
            DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                              rowCount + 1);
            DatabaseAssert.RecordLastAddedIdEquals(DataTestHelper.ConnectionString, ContentDataTestHelper.TermsTableName,
                                                   "TermID", newTermId);

            //Assert that new term is correct as first child of electronics
            TestTerm(newTermId, 2, 3);

            //Assert that existing terms are correct
            //Televisions, Id = 1, Left=12, Right=17 - should be Left=14, Right=19
            TestTerm(1, 14, 19);
            //Flash, Id = 9, Left=8, Right=9 - should be Left=10, Right=11
            TestTerm(9, 10, 11);
            //Electronics, Id = 12, Left=1, Right=18 - should be Left=1, Right=20
            TestTerm(12, 1, 20);
        }