private void CreateDeviceReadings()
        {
            IList <IStorageChannel>          channels = CreateSensorChannels();
            Dictionary <int, IStorageDevice> devices  = new Dictionary <int, IStorageDevice>();

            OverlordIdentity.InitializeAnonymousIdentity();
            AzureStorage storage = new AzureStorage();

            storage.AuthenticateAnonymousUser(TestData.user_02_id.UrnToId(),
                                              TestData.user_02_token);
            OverlordIdentity.AddClaim(Resource.Storage, StorageAction.FindUser);
            IStorageUser user = storage.GetCurrentUser();

            for (int i = 0; i <= 5; i++)
            {
                OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddDevice);
                IStorageDevice device = storage.AddDevice(user, "xUnit_IngestTests_Device_" + i.ToString(),
                                                          "xUnit_IngestTests_Device_Token", null, null);
                devices.Add(i, device);
            }
            IDictionary <int, IDictionary <string, object> > sensor_values = new Dictionary <int, IDictionary <string, object> >(6);

            for (int d = 0; d <= 5; d++)
            {
                sensor_values[d] = TestData.GenerateRandomSensorData(10);
                foreach (string s in sensor_values[d].Keys)
                {
                    IStorageSensor sensor = new IStorageSensor()
                    {
                        DeviceId = devices[d].Id,
                        Name     = s,
                        Channels = new List <Guid>()
                    };
                    List <IStorageAlert> alerts = new List <IStorageAlert>();
                    foreach (IStorageChannel channel in channels.Where(c => c.SensorType.ToSensorType() ==
                                                                       sensor.Name.ToSensorType()))
                    {
                        sensor.Channels.Add(channel.Id);
                    }
                    OverlordIdentity.AddClaim(Resource.Storage, StorageAction.UpdateDevice);
                    devices[d].Sensors.Add(new KeyValuePair <string, IStorageSensor>(s, sensor));
                    devices[d] = storage.UpdateDevice(devices[d]);
                }
            }
            OverlordIdentity.InitializeAnonymousIdentity();
            storage.AuthenticateAnonymousDevice(devices[0].Id.ToUrn(), devices[0].Token);
            for (int d = 0; d < devices.Count(); d++)
            {
                //Log.Partition();
                OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddDeviceReading);
                storage.AddDeviceReading(devices[d], TestData.GenerateRandomTime(null, null, null, null),
                                         sensor_values[d]);
                //Sleep for a random interval
                Thread.Sleep(TestData.GenerateRandomInteger(0, 1000));

                //Add another set of sensor data
                OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddDeviceReading);
                storage.AddDeviceReading(devices[d], TestData.GenerateRandomTime(null, null, null, null),
                                         TestData.GenerateRandomSensorData(sensor_values[d]));

                //Sleep for a random interval
                Thread.Sleep(TestData.GenerateRandomInteger(0, 1000));

                //Add another set of sensor data
                OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddDeviceReading);
                storage.AddDeviceReading(devices[d], TestData.GenerateRandomTime(null, null, null, null),
                                         TestData.GenerateRandomSensorData(sensor_values[d]));
            }
        }