public void SaveSubscriptionWithStudentDeclaration()
        {
            //取未征订学生申报
            var studentDeclarations = _appl.GetNotSubscriptionStudentDeclarationJiaoWu("2013-2014-2");
            var teacherDeclarations = _appl.GetNotSubscriptionTeacherDeclarationJiaoWu("2013-2014-2");
            //生成订单
            var subscriptions = SubscriptionService.CreateSubscriptionsByPress(studentDeclarations, teacherDeclarations);
            //保存
            var repo = new SubscriptionRepository(_context);

            for (int i = 0; i < subscriptions.Count(); i = i + 300)
            {
                foreach (var item in subscriptions.Skip(i).Take(300))
                {
                    repo.Add(item);
                }
                repo.Context.Commit();
            }

            var ids    = subscriptions.Select(d => d.ID);
            var result = repo.Find(t => ids
                                   .Contains(t.ID)
                                   );

            Assert.AreEqual(subscriptions.Count(), result.Count());
        }
Exemple #2
0
        public void GetSubscription()
        {
            var repo   = new SubscriptionRepository(_context);
            var result = repo.Find(t => t.SchoolYearTerm.Year == "2013-2014" && t.SchoolYearTerm.Term == "2");

            Assert.IsTrue(result.Count() > 0);
        }
 public void GetSubscriptionWithNotSubscription()
 {
     var repo = new SubscriptionRepository(_context);
     var result = repo.Find(t =>
         t.SchoolYearTerm.Year == "2013-2014" &&
         t.SchoolYearTerm.Term == "2" &&
         t.SubscriptionState == FeedbackState.未征订);
     Assert.IsTrue(result.Count() > 0);
 }
        public void SaveSubscriptionWithStudentDeclaration()
        {
            //取未征订学生申报
            var studentDeclarations = _appl.GetNotSubscriptionStudentDeclarationJiaoWu("2013-2014-2");
            var teacherDeclarations = _appl.GetNotSubscriptionTeacherDeclarationJiaoWu("2013-2014-2");
            //生成订单
            var subscriptions = SubscriptionService.CreateSubscriptionsByPress(studentDeclarations, teacherDeclarations);
            //保存
            var repo = new SubscriptionRepository(_context);
            for (int i = 0; i < subscriptions.Count(); i = i + 300)
            {
                foreach (var item in subscriptions.Skip(i).Take(300))
                {
                    repo.Add(item);
                }
                repo.Context.Commit();
            }

            var ids = subscriptions.Select(d => d.ID);
            var result = repo.Find(t => ids
                .Contains(t.ID)
                );
            Assert.AreEqual(subscriptions.Count(), result.Count());
        }