public AudioPlatformServiceTest() { _wowzaClient1 = new Mock <IWowzaHttpClient>(); _wowzaClient2 = new Mock <IWowzaHttpClient>(); _wowzaConfiguration = new WowzaConfiguration { StreamingEndpoint = "http://streamIt.com/" }; var logger = new Mock <ILogger <AudioPlatformService> >(); _audioPlatformService = new AudioPlatformService(new [] { _wowzaClient1.Object, _wowzaClient2.Object }, _wowzaConfiguration, logger.Object); }
public async Task CreateSharedAccessSignature_returns_token_created_using_StorageSharedKeyCredential() { var config = new WowzaConfiguration { StorageEndpoint = "https://container.blob.core.windows.net/", StorageContainerName = "container", StorageAccountName = "accountName", StorageAccountKey = "YWNjb3VudEtleQ==" }; var blobServiceClient = new Mock <BlobServiceClient>(); var service = new VhAzureStorageService(blobServiceClient.Object, config, false); var result = await service.CreateSharedAccessSignature("myFilePath", It.IsAny <TimeSpan>()); result.Should().NotBeNullOrEmpty(); result.Should().StartWith($"{config.StorageEndpoint}{config.StorageContainerName}/myFilePath?"); blobServiceClient .Verify(x => x.GetUserDelegationKeyAsync(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), It.IsAny <CancellationToken>()), Times.Never); }
public async Task GetAllBlobsAsync_returns_blob_clients() { var config = new WowzaConfiguration { StorageEndpoint = "https://container.blob.core.windows.net/", StorageContainerName = "container", StorageAccountName = "accountName", StorageAccountKey = "YWNjb3VudEtleQ==" }; var filePathPrefix = "myFilePath"; var blobServiceClient = new Mock <BlobServiceClient>(); var blobContainerClientMock = new Mock <BlobContainerClient>(); var blobClientMock = new Mock <BlobClient>(); blobServiceClient.Setup(x => x.GetBlobContainerClient(config.StorageContainerName)).Returns(blobContainerClientMock.Object); var pageable = new Mock <AsyncPageable <BlobItem> >(); blobContainerClientMock.Setup(x => x.GetBlobsAsync(BlobTraits.None, BlobStates.None, filePathPrefix, default)) .Returns(pageable.Object); pageable.Setup(x => x.GetAsyncEnumerator(default)).Returns(GetMockBlobItems());
public async Task CreateSharedAccessSignature_returns_token_created_using_DelegationKey() { var config = new WowzaConfiguration { StorageEndpoint = "https://container.blob.core.windows.net/", StorageContainerName = "container", StorageAccountName = "accountName", StorageAccountKey = "YWNjb3VudEtleQ==" }; var blobServiceClient = new Mock <BlobServiceClient>(); blobServiceClient .Setup(x => x.GetUserDelegationKeyAsync(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), It.IsAny <CancellationToken>())) .ReturnsAsync(Response.FromValue(BlobsModelFactory.UserDelegationKey("", "", "", "", "", DateTimeOffset.Now, DateTimeOffset.Now), null)); var service = new VhAzureStorageService(blobServiceClient.Object, config, true); var result = await service.CreateSharedAccessSignature("myFilePath", TimeSpan.FromDays(7)); result.Should().NotBeNullOrEmpty(); result.Should().StartWith($"{config.StorageEndpoint}{config.StorageContainerName}/myFilePath?"); blobServiceClient .Verify(x => x.GetUserDelegationKeyAsync(It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), It.IsAny <CancellationToken>()), Times.Once); }
public VhAzureStorageService(BlobServiceClient serviceClient, WowzaConfiguration wowzaConfig, bool useUserDelegation) : base(serviceClient, wowzaConfig, useUserDelegation) { }
public AudioPlatformService(IEnumerable <IWowzaHttpClient> wowzaClients, WowzaConfiguration configuration, ILogger <AudioPlatformService> logger) { _wowzaClients = wowzaClients; _configuration = configuration; _logger = logger; }