diff --git a/umbraco.Test/TagTest.cs b/umbraco.Test/TagTest.cs
new file mode 100644
index 0000000000..b5c824390a
--- /dev/null
+++ b/umbraco.Test/TagTest.cs
@@ -0,0 +1,302 @@
+using umbraco.cms.businesslogic.Tags;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using umbraco.cms.businesslogic.web;
+using System.Collections.Generic;
+using umbraco.cms.businesslogic;
+using System.Linq;
+
+namespace umbraco.Test
+{
+
+
+ ///
+ ///This is a test class for TagTest and is intended
+ ///to contain all TagTest Unit Tests
+ ///
+ [TestClass()]
+ public class TagTest
+ {
+
+ ///
+ /// Create a new tag and delete it
+ ///
+ [TestMethod()]
+ public void Tag_Make_New()
+ {
+ var t = Tag.AddTag(Guid.NewGuid().ToString("N"), Guid.NewGuid().ToString("N"));
+ Assert.IsTrue(t > 0); //id should be greater than zero
+ Assert.AreEqual(1, Tag.GetTags().Where(x => x.Id == t).Count());
+
+ Tag.RemoveTag(t);
+ //make sure it's gone
+ Assert.AreEqual(0, Tag.GetTags().Where(x => x.Id == t).Count());
+
+ }
+
+
+ #region Tests to write
+
+ /////
+ /////A test for Tag Constructor
+ /////
+ //[TestMethod()]
+ //public void TagConstructorTest()
+ //{
+ // int id = 0; // TODO: Initialize to an appropriate value
+ // string tag = string.Empty; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // int nodeCount = 0; // TODO: Initialize to an appropriate value
+ // Tag target = new Tag(id, tag, group, nodeCount);
+ // Assert.Inconclusive("TODO: Implement code to verify target");
+ //}
+
+ /////
+ /////A test for Tag Constructor
+ /////
+ //[TestMethod()]
+ //public void TagConstructorTest1()
+ //{
+ // Tag target = new Tag();
+ // Assert.Inconclusive("TODO: Implement code to verify target");
+ //}
+
+
+
+ /////
+ /////A test for AddTagsToNode
+ /////
+ //[TestMethod()]
+ //public void AddTagsToNodeTest()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // string tags = string.Empty; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // Tag.AddTagsToNode(nodeId, tags, group);
+ // Assert.Inconclusive("A method that does not return a value cannot be verified.");
+ //}
+
+ /////
+ /////A test for AssociateTagToNode
+ /////
+ //[TestMethod()]
+ //public void AssociateTagToNodeTest()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // int tagId = 0; // TODO: Initialize to an appropriate value
+ // Tag.AssociateTagToNode(nodeId, tagId);
+ // Assert.Inconclusive("A method that does not return a value cannot be verified.");
+ //}
+
+ /////
+ /////A test for GetDocumentsWithTags
+ /////
+ //[TestMethod()]
+ //public void GetDocumentsWithTagsTest()
+ //{
+ // string tags = string.Empty; // TODO: Initialize to an appropriate value
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetDocumentsWithTags(tags);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetNodesWithTags
+ /////
+ //[TestMethod()]
+ //public void GetNodesWithTagsTest()
+ //{
+ // string tags = string.Empty; // TODO: Initialize to an appropriate value
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetNodesWithTags(tags);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetTagId
+ /////
+ //[TestMethod()]
+ //public void GetTagIdTest()
+ //{
+ // string tag = string.Empty; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // int expected = 0; // TODO: Initialize to an appropriate value
+ // int actual;
+ // actual = Tag.GetTagId(tag, group);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetTags
+ /////
+ //[TestMethod()]
+ //public void GetTagsTest()
+ //{
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetTags(group);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetTags
+ /////
+ //[TestMethod()]
+ //public void GetTagsTest1()
+ //{
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetTags();
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetTags
+ /////
+ //[TestMethod()]
+ //public void GetTagsTest2()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetTags(nodeId);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for GetTags
+ /////
+ //[TestMethod()]
+ //public void GetTagsTest3()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // IEnumerable expected = null; // TODO: Initialize to an appropriate value
+ // IEnumerable actual;
+ // actual = Tag.GetTags(nodeId, group);
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for RemoveTagFromNode
+ /////
+ //[TestMethod()]
+ //public void RemoveTagFromNodeTest()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // string tag = string.Empty; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // Tag.RemoveTagFromNode(nodeId, tag, group);
+ // Assert.Inconclusive("A method that does not return a value cannot be verified.");
+ //}
+
+ /////
+ /////A test for RemoveTagsFromNode
+ /////
+ //[TestMethod()]
+ //public void RemoveTagsFromNodeTest()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // string group = string.Empty; // TODO: Initialize to an appropriate value
+ // Tag.RemoveTagsFromNode(nodeId, group);
+ // Assert.Inconclusive("A method that does not return a value cannot be verified.");
+ //}
+
+ /////
+ /////A test for RemoveTagsFromNode
+ /////
+ //[TestMethod()]
+ //public void RemoveTagsFromNodeTest1()
+ //{
+ // int nodeId = 0; // TODO: Initialize to an appropriate value
+ // Tag.RemoveTagsFromNode(nodeId);
+ // Assert.Inconclusive("A method that does not return a value cannot be verified.");
+ //}
+
+ /////
+ /////A test for Group
+ /////
+ //[TestMethod()]
+ //public void GroupTest()
+ //{
+ // Tag target = new Tag(); // TODO: Initialize to an appropriate value
+ // string expected = string.Empty; // TODO: Initialize to an appropriate value
+ // string actual;
+ // target.Group = expected;
+ // actual = target.Group;
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for Id
+ /////
+ //[TestMethod()]
+ //public void IdTest()
+ //{
+ // Tag target = new Tag(); // TODO: Initialize to an appropriate value
+ // int expected = 0; // TODO: Initialize to an appropriate value
+ // int actual;
+ // target.Id = expected;
+ // actual = target.Id;
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+
+ /////
+ /////A test for TagCaption
+ /////
+ //[TestMethod()]
+ //public void TagCaptionTest()
+ //{
+ // Tag target = new Tag(); // TODO: Initialize to an appropriate value
+ // string expected = string.Empty; // TODO: Initialize to an appropriate value
+ // string actual;
+ // target.TagCaption = expected;
+ // actual = target.TagCaption;
+ // Assert.AreEqual(expected, actual);
+ // Assert.Inconclusive("Verify the correctness of this test method.");
+ //}
+ #endregion
+
+ #region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //public static void MyClassInitialize(TestContext testContext)
+ //{
+ //}
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //public static void MyClassCleanup()
+ //{
+ //}
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //public void MyTestInitialize()
+ //{
+ //}
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //public void MyTestCleanup()
+ //{
+ //}
+ //
+ #endregion
+ }
+}
diff --git a/umbraco.Test/umbraco.Test.csproj b/umbraco.Test/umbraco.Test.csproj
index a15a7796a2..96074ed23e 100644
--- a/umbraco.Test/umbraco.Test.csproj
+++ b/umbraco.Test/umbraco.Test.csproj
@@ -155,6 +155,7 @@
+
diff --git a/umbraco.vsmdi b/umbraco.vsmdi
index c83c14b546..58397cc20f 100644
--- a/umbraco.vsmdi
+++ b/umbraco.vsmdi
@@ -1,6 +1,6 @@
-
+
-
+
\ No newline at end of file
diff --git a/umbraco/cms/businesslogic/Tags/Tag.cs b/umbraco/cms/businesslogic/Tags/Tag.cs
index 69389237a8..6fdcc5e3a4 100644
--- a/umbraco/cms/businesslogic/Tags/Tag.cs
+++ b/umbraco/cms/businesslogic/Tags/Tag.cs
@@ -78,6 +78,18 @@ namespace umbraco.cms.businesslogic.Tags
}
+ ///
+ /// Removes a tag from the database, this will also remove all relations
+ ///
+ ///
+ public static void RemoveTag(int tagId)
+ {
+ SqlHelper.ExecuteNonQuery("DELETE FROM cmsTagRelationship WHERE (tagid = @tagId)",
+ SqlHelper.CreateParameter("@tagId", tagId));
+ SqlHelper.ExecuteNonQuery("DELETE FROM cmsTags WHERE (id = @tagId)",
+ SqlHelper.CreateParameter("@tagId", tagId));
+ }
+
///
/// Delete all tag associations for the node specified
///