public void AddScheduledFilterTaskTest() { var taskdto = new ScheduledFilterTaskDto { Name = "ScheduledFilterTask", ScheduleExecTime = DateTime.Now, ScheduleRepeat = "OpenDay", Condition = new FilterConditionDto { Name = "ScheduledFilterTaskConditon", ExpressionString = "成交量>100", Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } } } }; var service = new FilterTaskAppService(); service.AddScheduledFilterTask(taskdto, 0); using (var context = RepositoryContext.Create()) { var repository = context.GetRepository<ScheduledFilterTaskRepository>(); var task = repository.GetAll().FirstOrDefault(); Assert.IsNotNull(task); } }
public void GetAllScheduledFilterTasksTest() { var taskdto = new ScheduledFilterTaskDto { Name = "ScheduledFilterTask", ScheduleExecTime = DateTime.Now, ScheduleRepeat = "OpenDay", Condition = new FilterConditionDto { Name = "ScheduledFilterTaskConditon", ExpressionString = "成交量>100", Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } } } }; var service = new FilterTaskAppService(); service.AddScheduledFilterTask(taskdto, 0); var tasks = service.GetAllScheduledFilterTasks(0).ToList(); Assert.IsNotNull(tasks); Assert.AreEqual(1, tasks.Count); }