public void ReloadRulesJob_Test(bool isTrue, TypiconVersionStatus status) { var context = TypiconDbContextFactory.Create(); var jobRepo = new JobRepository(); var handler = new ReloadRulesJobHandler(GetConfigRepo(), context, jobRepo); var job = new ReloadRulesJob(1, status); jobRepo.Create(job); var task = handler.ExecuteAsync(job); task.Wait(); Assert.AreEqual(0, jobRepo.GetAll().Count()); }
public ReloadRulesJob(int typiconId, TypiconVersionStatus status) { TypiconId = typiconId; TypiconVersionStatus = status; }
/// <summary> /// Возвращает указанную версию Устава (опубликованную или черновик). /// </summary> /// <param name="typiconVersionId"></param> /// <returns></returns> public static Result <TypiconVersion> GetTypiconVersion(this TypiconDBContext dbContext, int typiconId, TypiconVersionStatus status) { var version = dbContext.Set <TypiconVersion>() .FirstOrDefault(c => (status == TypiconVersionStatus.Draft) ? c.TypiconId == typiconId && c.BDate == null && c.EDate == null : c.TypiconId == typiconId && c.BDate != null && c.EDate == null); return((version != null) ? Result.Ok(version) : Result.Fail <TypiconVersion>("Указанный Устав либо не существует, либо не существует его версия.")); }