Пример #1
0
        public void Test1 ()
        {
            Login(XiakeNames.MZ_NAME);
            var chgd = new ConfigSettings.ChargeSettings()
            {
                IsChargeEnable = true,
                Accounts = new List<ConfigSettings.ChargeSettings.AccountData>(),
                Projects = new List<ConfigSettings.ChargeSettings.ProjectData>()
            };
            chgd.Accounts.Add(new ConfigSettings.ChargeSettings.AccountData(){ Account="xxxx",AccountTitle ="bbbb", ID=0, Organization="bank" });
            chgd.Projects.Add(new ConfigSettings.ChargeSettings.ProjectData(){ Credits=300,ID=0, Price=30});
            SystemService.UpdateChargeSettings(chgd );


            //×¢²áºÍµÇ¼Õƹñ
            var zg = LoginService.XiakeJoin(XiakeNames.ZG_NAME, "ok1234", "111111", "*****@*****.**", "22222222",
                XiakeType.Zhanggui, "");
            Login(XiakeNames.ZG_NAME);

            PayService.MakePay(0, 0);
            using(var db = DbContextFactory.CreateDbContext())
            {
                var pay = db.Pays.FirstOrDefault();
                Assert.AreEqual(false, pay.IsDisabled); 
                db.Database.ExecuteSqlCommand("update JinchenTest.dbo.Pays set CreateTime= DATEADD(DD,-6, CreateTime) ");
                 
            }

            PayHandleController.Run();
            using (var db = DbContextFactory.CreateDbContext())
            {
                var pay = db.Pays.FirstOrDefault();
                Assert.AreEqual(true, pay.IsDisabled);
            }
        }
        public void Test2()
        {
            //--修改邀请设置
            Login(XiakeNames.MZ_NAME);
            var vset = new ConfigSettings.InviteSettings()
            {
                Award = 3,
                IsEnableInvite = false,
                IsRejectNoInviteRegister = false
            };

            SystemService.UpdateInviteSettings(vset);

            var chgd = new ConfigSettings.ChargeSettings()
            {
                IsChargeEnable = true,
                Accounts = new List<ConfigSettings.ChargeSettings.AccountData>(),
                Projects = new List<ConfigSettings.ChargeSettings.ProjectData>()
            };
            chgd.Accounts.Add(new ConfigSettings.ChargeSettings.AccountData() { Account = "xxxx", AccountTitle = "bbbb", ID = 0, Organization = "bank" });
            chgd.Projects.Add(new ConfigSettings.ChargeSettings.ProjectData() { Credits = 300, ID = 0, Price = 30 });
            SystemService.UpdateChargeSettings(chgd);

            var mzd = LoginService.Login(XiakeNames.MZ_NAME, "ok1234", "");
            Assert.AreEqual(0, mzd.Credits);
            var d = LoginService.XiakeJoin(XiakeNames.ZG_NAME, "ok1234", "111111", "*****@*****.**", "111111", XiakeType.Zhanggui, InviteCodeHelper.GetInviteCodeWithXiakeId(mzd.ID));
            Assert.AreEqual(0, d.Credits);
            Login(XiakeNames.ZG_NAME);
            var pay = PayService.MakePay(0, 0);


            Login(XiakeNames.MZ_NAME);
            PayService.FinishPay(pay.Id);


            var mzd2 = LoginService.Login(XiakeNames.MZ_NAME, "ok1234", "");
            Assert.AreEqual(0, mzd2.Credits);

            InviteIncomeController.Run();

            var mzd3 = LoginService.Login(XiakeNames.MZ_NAME, "ok1234", "");
            Assert.AreEqual(0, mzd3.Credits);


        }