public void AddTagTest() { using (var scope = new TransactionScope()) { var tagId = productService.AddTag(tagName1); var tag = tagDao.Find(tagId); // Check data Assert.AreEqual(tagName1, tag.tagName); } }
public void TagProductTest() { using (TransactionScope scope = new TransactionScope()) { // Create Category long categoryId = CreateCategory("Music"); // Create Product long productId = CreateProduct(categoryId, "ACDC", 10, (float)10.5); // Create Tag long tagId = CreateTag("Rock", 0); // Tag a product tagService.TagProduct(productId, tagId); // Check the data Tag tag = tagDao.Find(tagId); Assert.AreEqual(tag.timesUsed, 1); Assert.AreEqual(tag.Products.ElementAt(0).productId, productId); Assert.AreEqual(productDao.Find(productId).Tags.ElementAt(0).tagId, tagId); } }