public TodoListAdapter(Context context,
                        int resource,
                        List <TodoItem> items,
                        ClientManager clientManager,
                        MongoClient.Collection itemSource) :
     base(context, resource, items)
 {
     this._itemSource    = itemSource;
     this._clientManager = clientManager;
 }
Exemplo n.º 2
0
        public async Task Setup()
        {
            app    = App.Create(myRealmAppId);
            user   = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            config = new SyncConfiguration("My Project", user);

            // :code-block-start: mongo-setup
            mongoClient      = user.GetMongoClient("mongodb-atlas");
            dbPlantInventory = mongoClient.GetDatabase("inventory");
            plantsCollection = dbPlantInventory.GetCollection <Plant>("plants");
            // :code-block-end:

            return;
        }
Exemplo n.º 3
0
        public async Task Setup()
        {
            app  = App.Create(myRealmAppId);
            user = await app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar"));

            config = new SyncConfiguration("myPartition", user);

            mongoClient      = user.GetMongoClient("mongodb-atlas");
            dbPlantInventory = mongoClient.GetDatabase("inventory");
            plantsCollection = dbPlantInventory.GetCollection <Plant>("plants");

            await InsertsOne();
            await InsertsMany();

            return;
        }
Exemplo n.º 4
0
        public async Task Creates()
        {
            app  = App.Create(myRealmAppId);
            user = await app.LogInAsync(Credentials.Anonymous());

            mongoClient   = user.GetMongoClient("mongodb-atlas");
            dbTracker     = mongoClient.GetDatabase("tracker");
            cudCollection = dbTracker.GetCollection <CustomUserData>("user_data");

            var cud = new CustomUserData(user.Id)
            {
                FavoriteColor = "pink",
                LocalTimeZone = "+8",
                IsCool        = true
            };

            var insertResult = await cudCollection.InsertOneAsync(cud);

            Assert.AreEqual(user.Id, insertResult.InsertedId);
        }
Exemplo n.º 5
0
        public async Task Setup()
        {
            app              = App.Create(myRealmAppId);
            user             = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            config           = new SyncConfiguration("myPartition", user);
            mongoClient      = user.GetMongoClient("mongodb-atlas");
            dbPlantInventory = mongoClient.GetDatabase("inventory");
            plantsCollection = dbPlantInventory.GetCollection <Plant>("plants");

            venus = new Plant
            {
                Name      = "Venus Flytrap",
                Sunlight  = Sunlight.Full,
                Color     = PlantColor.White,
                Type      = PlantType.Perennial,
                Partition = "Store 42"
            };
            sweetBasil = new Plant
            {
                Name      = "Sweet Basil",
                Sunlight  = Sunlight.Partial,
                Color     = PlantColor.Green,
                Type      = PlantType.Annual,
                Partition = "Store 42"
            };
            thaiBasil = new Plant
            {
                Name      = "Thai Basil",
                Sunlight  = Sunlight.Partial,
                Color     = PlantColor.Green,
                Type      = PlantType.Perennial,
                Partition = "Store 42"
            };
            helianthus = new Plant
            {
                Name      = "Helianthus",
                Sunlight  = Sunlight.Full,
                Color     = PlantColor.Yellow,
                Type      = PlantType.Annual,
                Partition = "Store 42"
            };
            petunia = new Plant
            {
                Name      = "Petunia",
                Sunlight  = Sunlight.Full,
                Color     = PlantColor.Purple,
                Type      = PlantType.Annual,
                Partition = "Store 47"
            };

            var listofPlants = new List <Plant>
            {
                venus,
                sweetBasil,
                thaiBasil,
                helianthus,
                petunia
            };

            var insertResult = await plantsCollection.InsertManyAsync(listofPlants);



            return;
        }
Exemplo n.º 6
0
 private void SetupPlantCollection()
 {
     mongoClient      = user.GetMongoClient("mongodb-atlas");
     dbPlantInventory = mongoClient.GetDatabase("inventory");
     plantsCollection = dbPlantInventory.GetCollection <Plant>("plants");
 }