Exemplo n.º 1
0
        public void Update_Test2()
        {
            var member     = InsertTestRecord();
            var expected   = "小章";
            var updateName = "yao";

            using (var db = new MemberDb())
            {
            }
        }
Exemplo n.º 2
0
 public void Insert_Test1()
 {
     using (var dbConnection = new MemberDb())
     {
         var memberToDb = new Member
         {
             Id   = Guid.NewGuid(),
             Name = "Yao",
             Age  = 12
         };
         var count = dbConnection.Insert(memberToDb);
         Assert.IsTrue(count > 0);
     }
 }
Exemplo n.º 3
0
 private static Member InsertTestRecord()
 {
     using (var dbConnection = new MemberDb())
     {
         var memberToDb = new Member
         {
             Id   = Guid.NewGuid(),
             Name = "Yao",
             Age  = 12
         };
         var count = dbConnection.Insert(memberToDb);
         return(memberToDb);
     }
 }
Exemplo n.º 4
0
        public void FirstOrDefault_Test1()
        {
            var member     = InsertTestRecord();
            var expected   = "小章";
            var updateName = "yao";

            using (var db = new MemberDb())
            {
                db.Members
                .Select(p => new Member()
                {
                    Id = p.Id, Name = p.Name
                })
                .FirstOrDefault();
            }
        }
Exemplo n.º 5
0
        public void Where_Test1()
        {
            var member     = InsertTestRecord();
            var expected   = "小章";
            var updateName = "yao";

            using (var db = new MemberDb())
            {
                db.Members
                .Select(p => new Member()
                {
                    Id = p.Id, Name = p.Name
                })
                .Where(p => p.Id == Guid.Parse(member.Id.ToString()))
                .FirstOrDefault();
            }
        }
Exemplo n.º 6
0
        public void Update_Test1()
        {
            var member     = InsertTestRecord();
            var expected   = "小章";
            var updateName = "yao";

            using (var db = new MemberDb())
            {
                db.Members
                .Select(p => new Member()
                {
                    Id = p.Id, Name = p.Name
                })
                .Where(p => p.Id == member.Id)
                .Set(p => p.Name, updateName)
                .Update();
            }
        }