コード例 #1
0
        public void AddDraftFilterTaskTest()
        {
            var taskdto = new DraftFilterTaskDto
                {
                    Name = "DraftTask",
                    Condition = new FilterConditionDto
                    {
                        Name = "DraftTaskConditon",
                        ExpressionString = "成交量>100",
                        Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } }
                    }
                };
            var service = new FilterTaskAppService();
            service.AddDraftFilterTask(taskdto, 0);

            using (var context = RepositoryContext.Create())
            {
                var repository = context.GetRepository<DraftFilterTaskRepository>();
                var task = repository.GetAll().FirstOrDefault();
                Assert.IsNotNull(task);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        public void GetAllDraftFilterTasksTest()
        {
            var taskdto = new DraftFilterTaskDto
                {
                    Name = "DraftTask",
                    Condition = new FilterConditionDto
                    {
                        Name = "DraftTaskConditon",
                        ExpressionString = "成交量>100",
                        Indicators = new List<IndicatorDto> { new IndicatorDto { Name = "成交量" } }
                    }
                };
            var service = new FilterTaskAppService();
            service.AddDraftFilterTask(taskdto, 0);

            var tasks = service.GetAllDraftFilterTasks(0).ToList();
            Assert.IsNotNull(tasks);
            Assert.AreEqual(1, tasks.Count);
        }
コード例 #4
0
        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);
        }