コード例 #1
0
        public void TestInsertWithStaticTypeObject()
        {
            var db = DatabaseHelper.Open();

            var user = new User { Id = 4, Name = "Zaphod", Password = "******", Age = 42, Address = new Address { State = "TX" } };

            var actual = db.Users.Insert(user);

            Assert.IsNotNull(user);
            Assert.AreEqual("Zaphod", actual.Name);
            Assert.AreEqual("zarquon", actual.Password);
            Assert.AreEqual(42, actual.Age);
        }
コード例 #2
0
        public void TestInsertWithStaticTypeObject()
        {
            var db = DatabaseHelper.Open();

            var user = new User { Id = 4, Name = "Zaphod", Password = "******", Age = 42, Address = new Address { State = "TX" }, EmailAddresses = new List<string> { "*****@*****.**", "*****@*****.**" } };

            db.Users.Insert(user);

            User actual = db.Users.FindById(4);

            Assert.IsNotNull(user);
            Assert.AreEqual("Zaphod", actual.Name);
            Assert.AreEqual("zarquon", actual.Password);
            Assert.AreEqual(42, actual.Age);
            Assert.IsNotNull(user.EmailAddresses);
            Assert.AreEqual("*****@*****.**", user.EmailAddresses[1]);
        }