Beispiel #1
0
        public void TestLogin()
        {
            var res   = GenerateLogedController <SimpleModel>();
            var Login = res.Item2;
            var Data  = res.Item1;

            Assert.True(ORM.Get <DustUserModel>().Insert(new DustUserModel(0, "username", "password", 0, null)));

            var loginAnswer = ResolveRequest(Login.WantLogin(new Core.Informations.Logins.LoginInformation("username", "password")));

            Assert.NotNull(loginAnswer);
        }
Beispiel #2
0
        //用户登陆
        public static Model.User UserLogin(Model.User user)
        {
            string SQL  = string.Format("UserName = '******' and Password = '******'", user.UserName, user.Password);
            object User = ORM.Get(new Model.User(), new Model.UserMapping(), Constant.CONNSTRING, SQL);

            if (User != null)
            {
                return((Model.User)User);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        public void BasicTest()
        {
            var target = new ORM("Library.mdb");

            var expected = new List<Book>
                {
                    new Book { Author = "Asimov", Title = "Pebble In The Sky", Pages = 235},
                    new Book { Author = "Asimov", Title = "Foundation and Empire", Pages = 325},
                    new Book { Author = "Asimov", Title = "Foundation", Pages = 466},
                    new Book { Author = "Asimov", Title = "Second Foundation", Pages = 388},
                    new Book { Author = "Asimov", Title = "The Caves of Steel ", Pages = 989},
                    new Book { Author = "Asimov", Title = "The End of Eternity", Pages = 234},
                };

            var actual = target.Get<Book>( book => book.Author == "Asimov" );

            Assert.That(actual, Is.EqualTo(expected));
        }
Beispiel #4
0
 //获取用户信息
 public static Model.User Get(Model.User user)
 {
     return((Model.User)ORM.Get(user, new Model.UserMapping(), Constant.CONNSTRING));
 }
Beispiel #5
0
 //获取地址详细信息
 public static Model.Address Get(Model.Address address)
 {
     return((Model.Address)ORM.Get(address, new Model.AddressMapping(), Constant.CONNSTRING));
 }