Skip to content

Commit 9432ec1

Browse files
committed
Add manual test project
1 parent 5a902a6 commit 9432ec1

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
<LangVersion>latest</LangVersion>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<None Remove="KeyVaultProvider.TestApp.csproj.DotSettings" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="ServiceBus.AttachmentPlugin" Version="[3.0.0-*, )" />
15+
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="[3.*, )" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\KeyVaultProvider\KeyVaultProvider.csproj" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Text;
3+
using System.Threading.Tasks;
4+
using Microsoft.Azure.ServiceBus;
5+
using Microsoft.Azure.ServiceBus.Core;
6+
using Microsoft.Azure.ServiceBus.Management;
7+
using ServiceBus.AttachmentPlugin;
8+
9+
namespace KeyVaultProviderTestApp
10+
{
11+
class Program
12+
{
13+
static async Task Main(string[] args)
14+
{
15+
var connectionString = Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString");
16+
var managementClient = new ManagementClient(connectionString);
17+
if (!await managementClient.QueueExistsAsync("attachments"))
18+
{
19+
await managementClient.CreateQueueAsync("attachments");
20+
}
21+
22+
var queueClient = new QueueClient(connectionString, "attachments", ReceiveMode.ReceiveAndDelete);
23+
24+
var configuration = new AzureStorageAttachmentConfiguration(new KeyVaultProvider("https://keyvaultplugin.vault.azure.net/secrets/storage-connection-string"));
25+
26+
queueClient.RegisterAzureStorageAttachmentPlugin(configuration);
27+
await queueClient.SendAsync(new Message(Encoding.UTF8.GetBytes("hello")));
28+
29+
var messageReceiver = new MessageReceiver(connectionString, "attachments", ReceiveMode.ReceiveAndDelete);
30+
messageReceiver.RegisterAzureStorageAttachmentPlugin(configuration);
31+
32+
var message = await messageReceiver.ReceiveAsync(TimeSpan.FromSeconds(3));
33+
34+
Console.WriteLine($"Received message with body: {Encoding.UTF8.GetString(message.Body)}");
35+
36+
Console.ReadLine();
37+
}
38+
}
39+
}

src/ServiceBus.AttachmentPlugin.KeyVaultProvider.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution
1313
EndProject
1414
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeyVaultProvider.Tests", "KeyVaultProvider.Tests\KeyVaultProvider.Tests.csproj", "{849A44A8-076D-4C16-8E7C-A65D9481094A}"
1515
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeyVaultProvider.TestApp", "KeyVaultProvider.TestApp\KeyVaultProvider.TestApp.csproj", "{585D937E-88FE-48C7-84EE-B2764798B903}"
17+
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1820
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
2729
{849A44A8-076D-4C16-8E7C-A65D9481094A}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{849A44A8-076D-4C16-8E7C-A65D9481094A}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{849A44A8-076D-4C16-8E7C-A65D9481094A}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{585D937E-88FE-48C7-84EE-B2764798B903}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{585D937E-88FE-48C7-84EE-B2764798B903}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{585D937E-88FE-48C7-84EE-B2764798B903}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{585D937E-88FE-48C7-84EE-B2764798B903}.Release|Any CPU.Build.0 = Release|Any CPU
3036
EndGlobalSection
3137
GlobalSection(SolutionProperties) = preSolution
3238
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)