File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
src/AzureOpenAIProxy.ApiApp/Repositories
test/AzureOpenAIProxy.ApiApp.Tests/Repositories Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ public interface IAdminEventRepository
4545/// </summary>
4646public class AdminEventRepository ( TableServiceClient tableServiceClient , StorageAccountSettings storageAccountSettings ) : IAdminEventRepository
4747{
48- private readonly TableServiceClient _tableServiceClient = tableServiceClient ?? throw new ArgumentException ( nameof ( tableServiceClient ) ) ;
49- private readonly StorageAccountSettings _storageAccountSettings = storageAccountSettings ?? throw new ArgumentException ( nameof ( storageAccountSettings ) ) ;
48+ private readonly TableServiceClient _tableServiceClient = tableServiceClient ?? throw new ArgumentNullException ( nameof ( tableServiceClient ) ) ;
49+ private readonly StorageAccountSettings _storageAccountSettings = storageAccountSettings ?? throw new ArgumentNullException ( nameof ( storageAccountSettings ) ) ;
5050
5151 /// <inheritdoc />
5252 public async Task < AdminEventDetails > CreateEvent ( AdminEventDetails eventDetails )
Original file line number Diff line number Diff line change @@ -29,6 +29,34 @@ public void Given_ServiceCollection_When_AddAdminEventRepository_Invoked_Then_It
2929 services . SingleOrDefault ( p => p . ServiceType == typeof ( IAdminEventRepository ) ) . Should ( ) . NotBeNull ( ) ;
3030 }
3131
32+ [ Fact ]
33+ public void Given_Null_TableServiceClient_When_Creating_AdminEventRepository_Then_It_Should_Throw_Exception ( )
34+ {
35+ // Arrange
36+ var settings = Substitute . For < StorageAccountSettings > ( ) ;
37+ var tableServiceClient = default ( TableServiceClient ) ;
38+
39+ // Act
40+ Action action = ( ) => new AdminEventRepository ( tableServiceClient , settings ) ;
41+
42+ // Assert
43+ action . Should ( ) . Throw < ArgumentNullException > ( ) ;
44+ }
45+
46+ [ Fact ]
47+ public void Given_Null_StorageAccountSettings_When_Creating_AdminEventRepository_Then_It_Should_Throw_Exception ( )
48+ {
49+ // Arrange
50+ var settings = default ( StorageAccountSettings ) ;
51+ var tableServiceClient = Substitute . For < TableServiceClient > ( ) ;
52+
53+ // Act
54+ Action action = ( ) => new AdminEventRepository ( tableServiceClient , settings ) ;
55+
56+ // Assert
57+ action . Should ( ) . Throw < ArgumentNullException > ( ) ;
58+ }
59+
3260 [ Fact ]
3361 public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Exception ( )
3462 {
You can’t perform that action at this time.
0 commit comments