Пример #1
0
        public async Task Can_Remove_Item()
        {
            try
            {
                ICollectionRef <WrapperModel> reference = new CollectionReference <WrapperModel>(litedbloc, "delete_collection");
                using WrapperModel _model = DataProvider.GetModel();
                reference.Insert(_model);
                await reference.Commit();

                reference.Remove(_model._ID);
                await reference.Commit();

                using WrapperModel _deletedModel = reference.Get(_model._ID);
                Assert.Null(_deletedModel);
                reference.Drop();
            }
            catch (Exception ex)
            { Assert.Null(ex); }
        }
Пример #2
0
        public async Task Can_Update_Item()
        {
            try
            {
                ICollectionRef <WrapperModel> reference = new CollectionReference <WrapperModel>(litedbloc, "update_collection");
                using (WrapperModel _model = DataProvider.GetModel())
                {
                    reference.Insert(_model);
                    await reference.Commit();

                    using WrapperModel _inserted = reference.Get(_model._ID);
                    _inserted.Word   = DataProvider.Word();
                    _inserted.Number = DataProvider.Number();
                    reference.Update(_inserted);
                    await reference.Commit();

                    using WrapperModel _updated = reference.Get(_inserted._ID);
                    VerifyAssertModels(_inserted, _updated);
                }
                reference.Drop();
            }
            catch (Exception ex)
            { Assert.Null(ex); }
        }