Skip to content

Commit 1393368

Browse files
committed
update tests
Related to: aliencube#319
1 parent 7e5a9a5 commit 1393368

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

test/AzureOpenAIProxy.ApiApp.Tests/Repositories/AdminEventRepositoryTests.cs

+20-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
using AzureOpenAIProxy.ApiApp.Models;
1+
using Azure.Data.Tables;
2+
3+
using AzureOpenAIProxy.ApiApp.Configurations;
4+
using AzureOpenAIProxy.ApiApp.Models;
25
using AzureOpenAIProxy.ApiApp.Repositories;
36

7+
using Castle.Core.Configuration;
8+
49
using FluentAssertions;
510

611
using Microsoft.Extensions.DependencyInjection;
712

13+
using NSubstitute;
14+
815
namespace AzureOpenAIProxy.ApiApp.Tests.Repositories;
916

1017
public class AdminEventRepositoryTests
@@ -26,8 +33,10 @@ public void Given_ServiceCollection_When_AddAdminEventRepository_Invoked_Then_It
2633
public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Exception()
2734
{
2835
// Arrange
36+
var settings = Substitute.For<StorageAccountSettings>();
37+
var tableServiceClient = Substitute.For<TableServiceClient>();
2938
var eventDetails = new AdminEventDetails();
30-
var repository = new AdminEventRepository();
39+
var repository = new AdminEventRepository(tableServiceClient, settings);
3140

3241
// Act
3342
Func<Task> func = async () => await repository.CreateEvent(eventDetails);
@@ -40,7 +49,9 @@ public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Excepti
4049
public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception()
4150
{
4251
// 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);
4455

4556
// Act
4657
Func<Task> func = async () => await repository.GetEvents();
@@ -53,8 +64,10 @@ public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception
5364
public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception()
5465
{
5566
// Arrange
67+
var settings = Substitute.For<StorageAccountSettings>();
68+
var tableServiceClient = Substitute.For<TableServiceClient>();
5669
var eventId = Guid.NewGuid();
57-
var repository = new AdminEventRepository();
70+
var repository = new AdminEventRepository(tableServiceClient, settings);
5871

5972
// Act
6073
Func<Task> func = async () => await repository.GetEvent(eventId);
@@ -67,9 +80,11 @@ public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception(
6780
public void Given_Instance_When_UpdateEvent_Invoked_Then_It_Should_Throw_Exception()
6881
{
6982
// Arrange
83+
var settings = Substitute.For<StorageAccountSettings>();
84+
var tableServiceClient = Substitute.For<TableServiceClient>();
7085
var eventId = Guid.NewGuid();
7186
var eventDetails = new AdminEventDetails();
72-
var repository = new AdminEventRepository();
87+
var repository = new AdminEventRepository(tableServiceClient, settings);
7388

7489
// Act
7590
Func<Task> func = async () => await repository.UpdateEvent(eventId, eventDetails);

0 commit comments

Comments
 (0)