Пример #1
0
        private IList <IStorageChannel> CreateSensorChannels()
        {
            OverlordIdentity.InitializeAnonymousIdentity();
            AzureStorage storage = new AzureStorage();

            storage.AuthenticateAnonymousDevice(TestData.device_02_id.UrnToId(),
                                                TestData.device_02_token);
            //OverlordIdentity.AddClaim(Resource.Storage, StorageAction.FindDevice);
            //IStorageDevice = storage.GetCurrentUser();

            IStorageAlert alert_1 = new IStorageAlert()
            {
                SensorType  = "I0",
                IntMaxValue = 100,
                IntMinValue = -10
            };
            IStorageAlert alert_2 = new IStorageAlert()
            {
                SensorType  = "I0",
                IntMaxValue = 40,
                IntMinValue = 0
            };

            List <IStorageAlert> alerts = new List <IStorageAlert>()
            {
                alert_1, alert_2
            };

            OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddChannel);
            IStorageChannel channel = storage.AddChannel("xUnit_IngestTests_Channel_01",
                                                         "A test channel for xUnit AzureStorageIngestTests", "I0", "Test integer units",
                                                         alerts);

            OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddChannel);
            alert_1 = new IStorageAlert()
            {
                SensorType  = "S0",
                StringValue = "Alert 1!"
            };
            alert_2 = new IStorageAlert()
            {
                SensorType  = "S0",
                StringValue = "Alert 1!"
            };

            alerts = new List <IStorageAlert>()
            {
                alert_1, alert_2
            };
            OverlordIdentity.AddClaim(Resource.Storage, StorageAction.AddChannel);
            IStorageChannel channel_2 = storage.AddChannel("xUnit_IngestTests_Channel_03",
                                                           "A test channel for xUnit AzureStorageIngestTests", "S0", "Test stringr units",
                                                           alerts);

            return(new List <IStorageChannel>()
            {
                channel, channel_2
            });
        }