public override double Calculate(DateTime publishingTimestamp, IStory story) { Check.Argument.IsNotNull(story, "story"); IKnownSource knownSource = _repository.FindMatching(story.Url); KnownSourceGrade grade = (knownSource == null) ? KnownSourceGrade.None : knownSource.Grade; return((int)grade); }
public void Add(IKnownSource entity) { Check.Argument.IsNotNull(entity, "entity"); KnownSource knownSource = (KnownSource)entity; if (_context.KnownSources.Any(ks => ks.Url == knownSource.Url)) { throw new ArgumentException("\"{0}\" source already exits. Specifiy a diffrent url.".FormatWith(knownSource.Url), "entity"); } base.Add(knownSource); }
public void Remove(IKnownSource entity) { base.Remove((KnownSource)entity); }