1
- using AzureOpenAIProxy . ApiApp . Models ;
1
+ using Azure . Data . Tables ;
2
+
3
+ using AzureOpenAIProxy . ApiApp . Configurations ;
4
+ using AzureOpenAIProxy . ApiApp . Models ;
2
5
using AzureOpenAIProxy . ApiApp . Repositories ;
3
6
7
+ using Castle . Core . Configuration ;
8
+
4
9
using FluentAssertions ;
5
10
6
11
using Microsoft . Extensions . DependencyInjection ;
7
12
13
+ using NSubstitute ;
14
+
8
15
namespace AzureOpenAIProxy . ApiApp . Tests . Repositories ;
9
16
10
17
public class AdminEventRepositoryTests
@@ -26,8 +33,10 @@ public void Given_ServiceCollection_When_AddAdminEventRepository_Invoked_Then_It
26
33
public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Exception ( )
27
34
{
28
35
// Arrange
36
+ var settings = Substitute . For < StorageAccountSettings > ( ) ;
37
+ var tableServiceClient = Substitute . For < TableServiceClient > ( ) ;
29
38
var eventDetails = new AdminEventDetails ( ) ;
30
- var repository = new AdminEventRepository ( ) ;
39
+ var repository = new AdminEventRepository ( tableServiceClient , settings ) ;
31
40
32
41
// Act
33
42
Func < Task > func = async ( ) => await repository . CreateEvent ( eventDetails ) ;
@@ -40,7 +49,9 @@ public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Excepti
40
49
public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception ( )
41
50
{
42
51
// Arrange
43
- var repository = new AdminEventRepository ( ) ;
52
+ var settings = Substitute . For < StorageAccountSettings > ( ) ;
53
+ var tableServiceClient = Substitute . For < TableServiceClient > ( ) ;
54
+ var repository = new AdminEventRepository ( tableServiceClient , settings ) ;
44
55
45
56
// Act
46
57
Func < Task > func = async ( ) => await repository . GetEvents ( ) ;
@@ -53,8 +64,10 @@ public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception
53
64
public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception ( )
54
65
{
55
66
// Arrange
67
+ var settings = Substitute . For < StorageAccountSettings > ( ) ;
68
+ var tableServiceClient = Substitute . For < TableServiceClient > ( ) ;
56
69
var eventId = Guid . NewGuid ( ) ;
57
- var repository = new AdminEventRepository ( ) ;
70
+ var repository = new AdminEventRepository ( tableServiceClient , settings ) ;
58
71
59
72
// Act
60
73
Func < Task > func = async ( ) => await repository . GetEvent ( eventId ) ;
@@ -67,9 +80,11 @@ public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception(
67
80
public void Given_Instance_When_UpdateEvent_Invoked_Then_It_Should_Throw_Exception ( )
68
81
{
69
82
// Arrange
83
+ var settings = Substitute . For < StorageAccountSettings > ( ) ;
84
+ var tableServiceClient = Substitute . For < TableServiceClient > ( ) ;
70
85
var eventId = Guid . NewGuid ( ) ;
71
86
var eventDetails = new AdminEventDetails ( ) ;
72
- var repository = new AdminEventRepository ( ) ;
87
+ var repository = new AdminEventRepository ( tableServiceClient , settings ) ;
73
88
74
89
// Act
75
90
Func < Task > func = async ( ) => await repository . UpdateEvent ( eventId , eventDetails ) ;
0 commit comments