Example #1
0
        public async Task DeleteSuccessAsync()
        {
            var model = TestModelFactory.GetModel();
            await ZaabeeMongoClient.AddAsync(model);

            Assert.Equal(1L, await ZaabeeMongoClient.DeleteAsync(model));
        }
Example #2
0
        public void DeleteSuccess()
        {
            var model = TestModelFactory.GetModel();

            ZaabeeMongoClient.Add(model);
            Assert.Equal(1L, ZaabeeMongoClient.Delete(model));
        }
Example #3
0
        public async Task AddAsync()
        {
            var model = TestModelFactory.GetModel();
            await ZaabeeMongoClient.AddAsync(model);

            var result = ZaabeeMongoClient.GetQueryable <TestModel>().FirstOrDefault(p => p.Id == model.Id);

            Assert.NotNull(result);
            Assert.Equal(model.ToJson(), result.ToJson());
        }
Example #4
0
        public void JoinTest1()
        {
            var testModel = TestModelFactory.GetModel();

            ZaabeeMongoClient.Add(testModel);
            var query = from a in ZaabeeMongoClient.GetQueryable <TestModel>()
                        join b in ZaabeeMongoClient.GetQueryable <TestModel>() on a.Id equals b.Id into joinedReadings
                        where a.Id == testModel.Id
                        select new { A = a, B = joinedReadings };

            Assert.Throws <NotSupportedException>(() => query.FirstOrDefault());
        }
Example #5
0
        public void UpdateSuccess()
        {
            var model = TestModelFactory.GetModel();

            ZaabeeMongoClient.Add(model);
            model.Int         = 199;
            model.String      = Guid.NewGuid().ToString();
            model.DateTimeUtc = DateTime.UtcNow;
            ZaabeeMongoClient.Update(model);
            var result = ZaabeeMongoClient.GetQueryable <TestModel>().FirstOrDefault(p => p.Id == model.Id);

            Assert.Equal(model.ToJson(), result.ToJson());
        }