Пример #1
0
        public static async Task Init(string storageAccountName, string storageAccountKey)
        {
            remoteFileIO = new RemoteFileIO(storageAccountName, storageAccountKey);
            localFileIO  = new LocalFileIO(storageAccountName, storageAccountKey);

            // Open a connection to the Edge runtime
            ModuleClient ioTHubModuleClient = await ModuleClient.CreateFromEnvironmentAsync(TransportType.Mqtt);

            await ioTHubModuleClient.OpenAsync().ConfigureAwait(false);

            // Register callback to be called when a message is received by the module
            await ioTHubModuleClient.SetInputMessageHandlerAsync("UploadFile", UploadFileMessage, ioTHubModuleClient);

            await ioTHubModuleClient.SetInputMessageHandlerAsync("DownloadFile", DownloadFileMessage, ioTHubModuleClient);

            await ioTHubModuleClient.SetInputMessageHandlerAsync("RemoveFile", RemoveFileMessage, ioTHubModuleClient);

            await ioTHubModuleClient.SetInputMessageHandlerAsync("WriteFile", WriteFileMessage, ioTHubModuleClient);

            await ioTHubModuleClient.SetInputMessageHandlerAsync("GetFile", GetFileMessage, ioTHubModuleClient);

            await ioTHubModuleClient.SetInputMessageHandlerAsync("ListFiles", ListFilesMessage, ioTHubModuleClient);

            Console.WriteLine("EdgeHub logging module has been initialized");
        }
Пример #2
0
        public async void Should_Exception_When_FileIsNotFound()
        {
            // arrange
            var io = new RemoteFileIO("", "");

            // act
            await io.DownloadFile("/data", "test.txt", "https://loggingmodulestore.blob.core.windows.net/data/Test.txt?sp=r&st=2018-10-11T00:49:40Z&se=2018-10-11T08:49:40Z&spr=https&sv=2017-11-09&sig=yT3Sl79RLgrl5VDYXXAKjODL9mIiX7PGgYe3bzKl3Dg%3D&sr=b");

            // assert
            Assert.Equal(null, null);
        }