public async Task StateChangeProcessor_MergeDocument()
        {
            var doc1 = new Document()
            {
                Id = "device001"
            };

            doc1.SetPropertyValue("Battery", 0.5);
            var client = CreateMockClient(doc1);

            var option = new StateChangeProcessorOptions {
                COSMOSDB_DATABASE_COL = "col", COSMOSDB_DATABASE_NAME = "db"
            };
            var processor = new StateChangeProcessor(client.Object, Options.Create <StateChangeProcessorOptions>(option));
            var logger    = new Mock <ILogger>();

            var update = new DeviceState();

            update.DeviceId  = "device001";
            update.Latitude  = 10;
            update.Longitude = 20;
            update.Altitude  = 30;

            var response = await processor.UpdateState(update, logger.Object);

            DeviceState result = (dynamic)response.Resource;

            Assert.AreEqual("device001", result.DeviceId);
            Assert.AreEqual(0.5, result.Battery);
            Assert.AreEqual(10, result.Latitude);
            Assert.AreEqual(20, result.Longitude);
            Assert.AreEqual(30, result.Altitude);
        }
        public async Task StateChangeProcessor_CreateDocument()
        {
            var client = CreateMockClient(null);

            var option = new StateChangeProcessorOptions {
                COSMOSDB_DATABASE_COL = "col", COSMOSDB_DATABASE_NAME = "db"
            };
            var processor = new StateChangeProcessor(client.Object, Options.Create <StateChangeProcessorOptions>(option));
            var logger    = new Mock <ILogger>();

            var updatedState = new DeviceState();

            updatedState.DeviceId = "device001";
            updatedState.Battery  = 1;

            var result = await processor.UpdateState(updatedState, logger.Object);

            DeviceState resultDoc = (dynamic)result.Resource;

            Assert.AreEqual("device001", resultDoc.DeviceId);
            Assert.AreEqual(1, resultDoc.Battery);
        }