Exemple #1
0
        public void TestMethod0()
        {
            var testObject = new TestObject();
            var id = Guid.NewGuid();
            testObject.Id = id;
            testObject.Value = 1345;
            _Redis.Add(testObject);

            var results = _Redis.Find<TestObject>(test_object => test_object.Id == id);
            Assert.AreEqual(1345, results.First().Value);
        }
        public void TestMethod1()
        {
            var testObject = new TestObject();
            var id = Guid.NewGuid();
            testObject.Id = id;
            testObject.Value = 1345;
            _Redis.Add(testObject);

            var mapper = new Regulus.Database.Redis.Mapper<TestObject>(_Redis , obj => obj.Id == id);
            mapper.Update<int>(obj => obj.Value, 99);
            var result = mapper.Get<int>(obj => obj.Value);
            Assert.AreEqual(99 , result.First());
        }
Exemple #3
0
        public void TestMethod3()
        {
            var id = Guid.NewGuid();
            var testObject = new TestObject();
            testObject.Id = id;
            testObject.Value = 1345;
            _Redis.Add(testObject);

            testObject.Value = 13451;
            _Redis.UpdateField<TestObject , int>(test_object => test_object.Id == id, test_object => test_object.Value , 9999);

            var results = _Redis.Find<TestObject>(test_object => test_object.Id == id);
            Assert.AreEqual(9999, results.First().Value);
        }
Exemple #4
0
        public void TestMethod999()
        {
            var id = Guid.NewGuid();
            var testObject = new TestObject();
            testObject.Id = id;
            testObject.Value = 1345;
            _Redis.Add(testObject);

            var results = _Redis.Delete<TestObject>(t => true);
            Assert.AreNotEqual(0 , results);
        }
Exemple #5
0
        public void TestMethod9()
        {
            var testObject1 = new TestObject();

            testObject1.Value = 13451;

            var testObject2 = new TestObject1();

            testObject2.Value = 13454651;

            var id = Guid.NewGuid();
            var testObject = new TestObject();
            testObject.Id = id;
            testObject.Value = 1345;
            testObject.Child = testObject1;
            testObject.Field2 = testObject2;

            _Redis.Add(testObject);

            var results = _Redis.GetField<TestObject, TestObject1>(test_object => test_object.Id == id, o => o.Field2);
            Assert.AreEqual(13454651, results.First().Value);
        }
Exemple #6
0
        public void TestMethod7()
        {
            var testObject1 = new TestObject();

            testObject1.Value = 13451;

            var id = Guid.NewGuid();
            var testObject = new TestObject();
            testObject.Id = id;
            testObject.Value = 1345;
            testObject.Child = testObject1;

            _Redis.Add(testObject);

            testObject.Value = 13451;
            _Redis.UpdateField<TestObject, TestObject>(test_object => test_object.Id == id, test_object => test_object.Child, null );

            var results = _Redis.GetField<TestObject , TestObject>(test_object => test_object.Id == id , o => o.Child );
            Assert.AreEqual(null, results.First());
        }