File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed
src/GodelTech.Messaging.AzureServiceBus
test/GodelTech.Messaging.AzureServiceBus.Tests/DependencyInjection Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace GodelTech.Messaging.AzureServiceBus
99 /// <summary>
1010 /// Azure Service Bus sender
1111 /// </summary>
12- public class AzureServiceBusSender
12+ public class AzureServiceBusSender : IAzureServiceBusSender
1313 {
1414 private readonly ServiceBusClient _serviceBusClient ;
1515 private readonly AzureServiceBusOptions _azureServiceBusOptions ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public static IServiceCollection AddAzureServiceBusSender(
2929 services . Configure ( optionsAction ) ;
3030
3131 // AzureServiceBusSender
32- services . AddTransient < AzureServiceBusSender > ( ) ;
32+ services . AddTransient < IAzureServiceBusSender , AzureServiceBusSender > ( ) ;
3333
3434 return services ;
3535 }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Threading . Tasks ;
3+
4+ namespace GodelTech . Messaging . AzureServiceBus
5+ {
6+ /// <summary>
7+ /// Interface of Azure Service Bus sender
8+ /// </summary>
9+ public interface IAzureServiceBusSender
10+ {
11+ /// <summary>
12+ /// Asynchronously sends TModel object as JSON to Azure Service Bus queue.
13+ /// Queue is select by key from options.
14+ /// </summary>
15+ /// <typeparam name="TModel">The type of the T model.</typeparam>
16+ /// <param name="queueKey">Queue key.</param>
17+ /// <param name="model">The model.</param>
18+ /// <exception cref="ArgumentOutOfRangeException">No queue found with provided key.</exception>
19+ public Task SendAsync < TModel > ( string queueKey , TModel model )
20+ where TModel : class ;
21+ }
22+ }
Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ public void AddAzureServiceBusSender_Success()
4343 Assert . NotNull ( resultOptionsAction . Value ) ;
4444 Assert . Equal ( queues , resultOptionsAction . Value . Queues ) ;
4545
46- var resultAzureServiceBusSender = provider . GetRequiredService < AzureServiceBusSender > ( ) ;
46+ var resultAzureServiceBusSender = provider . GetRequiredService < IAzureServiceBusSender > ( ) ;
4747 Assert . NotNull ( resultAzureServiceBusSender ) ;
48+ Assert . IsType < AzureServiceBusSender > ( resultAzureServiceBusSender ) ;
4849 }
4950 }
5051}
You can’t perform that action at this time.
0 commit comments