public void GetSpecific_ForCategory() { RepositoriesSet repositoriesSet = new RepositoriesSet(); repositoriesSet.Register <DbCategory, ICategoryRepository>(new CategoryRepository(new Mock <IImgBoardContext>().Object)); var repository = repositoriesSet.GetSpecific <DbCategory, ICategoryRepository>(); Assert.IsInstanceOf <ICategoryRepository>(repository); }
public void GetSpecific_ForArticle() { RepositoriesSet repositoriesSet = new RepositoriesSet(); repositoriesSet.Register <Article, IArticlesRepository>(new ArticlesRepository(new Mock <ICoreBusinessContext>().Object)); var repository = repositoriesSet.GetSpecific <Article, IArticlesRepository>(); Assert.IsInstanceOf <IArticlesRepository>(repository); }
public void GetSpecific_ForCategory_NotRegistered() { RepositoriesSet repositoriesSet = new RepositoriesSet(); DalException ex = Assert.Throws <DalException>(() => { repositoriesSet.GetGeneric <DbCategory>(); }); Assert.That(ex.errorType, Is.EqualTo(DalErrorType.RepositoriesSetMissingMapping)); Assert.That(ex.Message, Is.EqualTo("Instance is missing for ImgBoard.Dal.Models.Main.DbCategory")); }
public void GetSpecific_ForArticle_NotRegistered() { RepositoriesSet repositoriesSet = new RepositoriesSet(); DalException ex = Assert.Throws <DalException>(() => { repositoriesSet.GetGeneric <Article>(); }); Assert.That(ex.errorType, Is.EqualTo(DalErrorType.RepositoriesSetMissingMapping)); Assert.That(ex.Message, Is.EqualTo("Instance is missing for GenericStructure.Models.CoreBusiness.Article")); }
public BaseCoreBusinessService(ICoreBusinessContext context) : base(context) { base.context = context; base.policy = DataConflictPolicy.ClientWins; this.repositoriesSet = new RepositoriesSet(); }
public BaseMainService(IImgBoardContext context) : base(context) { base.context = context; base.policy = DataConflictPolicy.ClientWins; this.repositoriesSet = new RepositoriesSet(); }