public MetaTag UpdateMetaTag(MetaTag updatedTag)
        {
            updatedTag.BlogId = Config.CurrentBlog.Id;
            MetaTags.Update(updatedTag);

            return updatedTag;
        }
        public void MetaTagRequiresContentAttribute(string contentValue, bool isValidResult, string errMsg)
        {
            var tag = new MetaTag(contentValue);
            tag.Name = "description";

            Assert.AreEqual(tag.IsValid, isValidResult);
        }
Beispiel #3
0
        public MetaTag AddMetaTagForBlog(string content, string name, string httpEquiv)
        {
            var newTag = new MetaTag(content) { Name = name, HttpEquiv = httpEquiv, BlogId = Config.CurrentBlog.Id, DateCreatedUtc = DateTime.UtcNow };

            Repository.Create(newTag);

            return newTag;
        }
Beispiel #4
0
        public void MetaTagRequiresEitherNameOrHttpEquivAttribute(string nameValue, string httpEquivValue, bool isValidResult, string errMsg)
        {
            MetaTag tag = new MetaTag("Steve rocks it!");
            tag.Name = nameValue;
            tag.HttpEquiv = httpEquivValue;

            Assert.AreEqual(tag.IsValid, isValidResult, errMsg);
        }
Beispiel #5
0
        public static bool Update(MetaTag metaTag)
        {
            if (metaTag == null)
                throw new ArgumentNullException("metaTag", "The meta tag can not be NULL.");

            if (!metaTag.IsValid)
                throw new ArgumentException(metaTag.ValidationMessage);

            return ObjectProvider.Instance().Update(metaTag);
        }
Beispiel #6
0
        public MetaTag AddMetaTagForBlog(string content, string name, string httpEquiv)
        {
            MetaTag newTag = new MetaTag(content);
            newTag.Name = name;
            newTag.HttpEquiv = httpEquiv;
            newTag.BlogId = Config.CurrentBlog.Id;
            newTag.DateCreated = DateTime.Now;

            MetaTags.Create(newTag);

            return newTag;
        }
Beispiel #7
0
        public static bool Update(MetaTag metaTag)
        {
            if(metaTag == null)
            {
                throw new ArgumentNullException("metaTag");
            }

            if(!metaTag.IsValid)
            {
                throw new ArgumentException(metaTag.ValidationMessage);
            }

            return ObjectProvider.Instance().Update(metaTag);
        }
Beispiel #8
0
        public static int Create(MetaTag metaTag)
        {
            if(metaTag == null)
            {
                throw new ArgumentNullException("metaTag");
            }

            if(!metaTag.IsValid)
            {
                throw new ArgumentException(metaTag.ValidationMessage);
            }
            metaTag.Id = ObjectProvider.Instance().Create(metaTag);

            return metaTag.Id;
        }
        public override int Create(MetaTag metaTag)
        {
            if (metaTag == null)
            {
                throw new ArgumentNullException("metaTag");
            }

            if (!metaTag.IsValid)
            {
                throw new ArgumentException(metaTag.ValidationMessage);
            }
            if (metaTag.DateCreatedUtc.Kind != DateTimeKind.Utc)
            {
                throw new InvalidOperationException("Metadata Create date must be UTC");
            }
            metaTag.Id = _procedures.InsertMetaTag(metaTag.Content,
                                             metaTag.Name.NullIfEmpty(),
                                             metaTag.HttpEquiv.NullIfEmpty(),
                                             BlogId,
                                             metaTag.EntryId,
                                             metaTag.DateCreatedUtc);
            return metaTag.Id;
        }
Beispiel #10
0
        public static MetaTag LoadMetaTag(IDataReader reader)
        {
            MetaTag tag = new MetaTag();

            tag.Id = ReadInt32(reader, "Id");
            tag.Content = ReadString(reader, "Content");
            tag.Name = ReadString(reader, "Name");
            tag.HttpEquiv = ReadString(reader, "HttpEquiv");
            tag.BlogId = ReadInt32(reader, "BlogId");
            tag.EntryId = ReadNullableInt(reader, "EntryId");
            tag.DateCreated = ReadDate(reader, "DateCreated");

            return tag;
        }
 private static void InsertNewMetaTag(string content, string nameValue, string httpEquivValue, DateTime created,
     int blogId, int? entryId)
 {
     var metaTag = new MetaTag();
     metaTag.Content = content;
     metaTag.Name = nameValue;
     metaTag.HttpEquiv = httpEquivValue;
     metaTag.DateCreated = created;
     metaTag.BlogId = blogId;
     metaTag.EntryId = entryId;
     ObjectProvider.Instance().Create(metaTag);
 }
Beispiel #12
0
 /// <summary>
 /// Adds the given MetaTag to the data store.
 /// </summary>
 /// <param name="metaTag"></param>
 /// <returns></returns>
 public abstract int Create(MetaTag metaTag);
Beispiel #13
0
 /// <summary>
 /// Updates the given MetaTag in the data store.
 /// </summary>
 /// <param name="metaTag"></param>
 /// <returns></returns>
 public abstract bool Update(MetaTag metaTag);
Beispiel #14
0
 private static void InsertNewMetaTag(string content, string nameValue, string httpEquivValue, DateTime created,
                                      int blogId, int? entryId)
 {
     var repository = new DatabaseObjectProvider();
     var metaTag = new MetaTag();
     metaTag.Content = content;
     metaTag.Name = nameValue;
     metaTag.HttpEquiv = httpEquivValue;
     metaTag.DateCreatedUtc = created;
     metaTag.BlogId = blogId;
     metaTag.EntryId = entryId;
     repository.Create(metaTag);
 }
 public override bool Update(MetaTag metaTag)
 {
     return DbProvider.Instance().UpdateMetaTag(metaTag);
 }
 public void Create(int index)
 {
     MetaTag tag = new MetaTag("test" + index);
     tag.DateCreated = DateTime.Now;
     tag.Name = "foo";
     tag.BlogId = Config.CurrentBlog.Id;
     MetaTags.Create(tag);
 }
Beispiel #17
0
 private static void ValidateMetaTags(MetaTag expected, MetaTag result)
 {
     Assert.AreEqual(expected.Content, result.Content, "Content didn't get updated.");
     Assert.AreEqual(expected.Name, result.Name, "Name attribute didn't get updated.");
     Assert.AreEqual(expected.HttpEquiv, result.HttpEquiv, "Http-Equiv attribute didn't get updated");
 }
Beispiel #18
0
        public void Update_WithInvalidMetaTag_ThrowsArgumentException()
        {
            // arrange
            var metaTag = new MetaTag(null);
            var repository = new DatabaseObjectProvider();

            // act, assert
            Assert.IsFalse(metaTag.IsValid);
            UnitTestHelper.AssertThrows<ArgumentException>(() => repository.Update(metaTag));
        }
 public override int Create(MetaTag metaTag)
 {
     return DbProvider.Instance().InsertMetaTag(metaTag);
 }
Beispiel #20
0
 public abstract int InsertMetaTag(MetaTag metaTag);
        public void Update_WithInvalidMetaTag_ThrowsArgumentException()
        {
            // arrange
            var metaTag = new MetaTag(null);

            // act, assert
            Assert.IsFalse(metaTag.IsValid);
            UnitTestHelper.AssertThrows<ArgumentException>(() => MetaTags.Update(metaTag));
        }
        public override bool Update(MetaTag metaTag)
        {
            if (metaTag == null)
            {
                throw new ArgumentNullException("metaTag");
            }

            if (!metaTag.IsValid)
            {
                throw new ArgumentException(metaTag.ValidationMessage);
            }

            return _procedures.UpdateMetaTag(metaTag.Id,
                                             metaTag.Content,
                                             metaTag.Name.NullIfEmpty(),
                                             metaTag.HttpEquiv.NullIfEmpty(),
                                             BlogId,
                                             metaTag.EntryId);
        }