Esempio n. 1
0
        public void ValueObjectTestLambdaWhereReversed()
        {
            var myNameObject = new MyNameObject()
            {
                Value = "Name1"
            };
            var user = Database.Query <User1>().Where(x => myNameObject == x.Name).Single();

            Assert.AreEqual("Name1", user.Name.Value);
        }
Esempio n. 2
0
        public void ValueObjectTestUpdate()
        {
            var myNameObject = new MyNameObject()
            {
                Value = "Name1"
            };
            var user = Database.Query <User1>().Where(x => x.Name == myNameObject).Single();

            user.Name.Value = "Name111";
            Database.Update(user);
            var updateUser = Database.Query <User1>().Where(x => x.Name == user.Name).Single();

            Assert.AreEqual("Name111", updateUser.Name.Value);
        }
Esempio n. 3
0
        public void ValueObjectTestInsert()
        {
            var myNameObject = new MyNameObject()
            {
                Value = "Name20"
            };
            var user = new User1 {
                Name = myNameObject
            };

            Database.Insert(user);
            var newUser = Database.Query <User1>().Where(x => x.Name == myNameObject).Single();

            Assert.AreEqual("Name20", newUser.Name.Value);
        }
Esempio n. 4
0
        public void ValueObjectTestDelete()
        {
            var myNameObject = new MyNameObject()
            {
                Value = "Name21"
            };
            var user = new User1 {
                Name = myNameObject
            };

            Database.Insert(user);
            var newUser = Database.Query <User1>().Where(x => x.Name == myNameObject).Single();

            Database.Delete(newUser);
            var deletedUser = Database.Query <User1>().Where(x => x.Name == myNameObject).SingleOrDefault();

            Assert.Null(deletedUser);
        }
Esempio n. 5
0
        public void ValueObjectTestUpdateWhere()
        {
            var myNameObject = new MyNameObject()
            {
                Value = "Name1"
            };
            var myNameObject2 = new MyNameObject()
            {
                Value = "Name21"
            };
            var user = new User1 {
                Name = myNameObject2
            };

            Database.UpdateMany <User1>().Where(x => x.Name == myNameObject).Execute(user);
            var updateUser = Database.Query <User1>().Where(x => x.Name == myNameObject2).Single();

            Assert.AreEqual("Name21", updateUser.Name.Value);
        }