public void BerlukiRu_Test() { DateTime date = new DateTime(2019, 09, 03);//DateTime.Now; if ((date.DayOfWeek == DayOfWeek.Sunday) && (date.Hour > 17)) { date = date.AddDays(1); } var queryProcessor = DataQueryProcessorFactory.Create(); var week = queryProcessor.Process(new OutputWeekQuery(TYPICON_ID, date, new OutputFilter() { Language = "cs-ru" })); var htmlViewer = new HtmlSimpleScheduleWeekViewer(); string resultString = htmlViewer.Execute(TYPICON_ID, week.Value); date = date.AddDays(7); week = queryProcessor.Process(new OutputWeekQuery(TYPICON_ID, date, new OutputFilter() { Language = "cs-ru" })); resultString += htmlViewer.Execute(TYPICON_ID, week.Value); Assert.Pass(resultString); }
public void DataQueryProcessorTest_Create() { var processor = DataQueryProcessorFactory.Create(); var easterDate = processor.Process(new CurrentEasterQuery(2018)); Assert.AreEqual(2018, easterDate.Year); }
public void AllMenologyRulesQueryHandler_Test() { var queryProcessor = DataQueryProcessorFactory.Create(); var result = queryProcessor.Process(new AllMenologyDaysQuery("cs-ru")); var list = result.Value.ToList(); Assert.IsNotNull(list); }
public static CalculateModifiedYearJobHandler Build(TypiconDBContext dbContext, JobRepository jobRepo) { var query = DataQueryProcessorFactory.Create(dbContext); var command = CommandProcessorFactory.Create(dbContext); var serializerRoot = TestRuleSerializer.Create(dbContext); var settingsFactory = new RuleHandlerSettingsFactory(serializerRoot); return(new CalculateModifiedYearJobHandler(dbContext, settingsFactory, jobRepo)); }
public static CalculateOutputFormWeekJobHandler Build(TypiconDBContext dbContext, JobRepository jobRepo) { var query = DataQueryProcessorFactory.Create(dbContext); var serializerRoot = TestRuleSerializer.Create(dbContext); var settingsFactory = new RuleHandlerSettingsFactory(serializerRoot); var outputFormFactory = new OutputDayFactory(new MajorDataCalculator(query, settingsFactory) , new ScheduleDayNameComposer(query) , serializerRoot.TypiconSerializer , new ServiceSequenceHandler()); return(new CalculateOutputFormWeekJobHandler(dbContext, outputFormFactory, jobRepo)); }
public void DocxToStreamWeekViewer_Test() { var query = DataQueryProcessorFactory.Create(); var mock = new Mock<IConfigurationRepository>(); mock.Setup(c => c.GetConfigurationValue(It.IsAny<string>())) .Returns($@"{TestContext.CurrentContext.TestDirectory}\Data\BigTemplate.docx"); var viewer = new DocxToStreamWeekViewer(query, mock.Object); var week = new FilteredOutputWeek() { Name = new ItemTextUnit("cs-ru", "Первая седмица Великого поста"), Days = new List<FilteredOutputDay>() { new FilteredOutputDay() { Date = DateTime.Today, Header = new FilteredOutputDayHeader() { Name = new ItemTextUnit("cs-ru", "Торжество Православия") }, Worships = new List<FilteredOutputWorship>() { new FilteredOutputWorship() { Time = "06.00", Name = new FilteredParagraph() { Text = new ItemTextUnit("cs-ru", "Полунощница") } } } } } }; var result = viewer.Execute(1, week); //using (Stream file = File.Create($@"{TestContext.CurrentContext.TestDirectory}\Data\Output.docx")) //{ // file.Write(result.Value.Content, 0, result.Value.Content.Length); //} Assert.True(result.Value.Content.Length > 0, "Пустой файл"); }
private OutputDayFactory Build() { var dbContext = TypiconDbContextFactory.Create(); var query = DataQueryProcessorFactory.Create(dbContext); var serializerRoot = TestRuleSerializer.Create(dbContext); var settingsFactory = new RuleHandlerSettingsFactory(serializerRoot); var dataCalculator = new ExplicitDataCalculator(query, new AsAdditionDataCalculator(query, new TransparentDataCalculator(query, new MajorDataCalculator(query, settingsFactory) , settingsFactory) , settingsFactory) , settingsFactory); return(new OutputDayFactory(dataCalculator , new ScheduleDayNameComposer(query) , serializerRoot.TypiconSerializer , new ServiceSequenceHandler())); }
public SignQueryHandlerTest() { processor = DataQueryProcessorFactory.Create(); }
protected QueryTestBase() { Processor = DataQueryProcessorFactory.Create(); }