Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Related to: #319
  • Loading branch information
sikutisa committed Sep 14, 2024
1 parent 7e5a9a5 commit 1393368
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using AzureOpenAIProxy.ApiApp.Models;
using Azure.Data.Tables;

using AzureOpenAIProxy.ApiApp.Configurations;
using AzureOpenAIProxy.ApiApp.Models;
using AzureOpenAIProxy.ApiApp.Repositories;

using Castle.Core.Configuration;

using FluentAssertions;

using Microsoft.Extensions.DependencyInjection;

using NSubstitute;

namespace AzureOpenAIProxy.ApiApp.Tests.Repositories;

public class AdminEventRepositoryTests
Expand All @@ -26,8 +33,10 @@ public void Given_ServiceCollection_When_AddAdminEventRepository_Invoked_Then_It
public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Exception()
{
// Arrange
var settings = Substitute.For<StorageAccountSettings>();
var tableServiceClient = Substitute.For<TableServiceClient>();
var eventDetails = new AdminEventDetails();
var repository = new AdminEventRepository();
var repository = new AdminEventRepository(tableServiceClient, settings);

// Act
Func<Task> func = async () => await repository.CreateEvent(eventDetails);
Expand All @@ -40,7 +49,9 @@ public void Given_Instance_When_CreateEvent_Invoked_Then_It_Should_Throw_Excepti
public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception()
{
// Arrange
var repository = new AdminEventRepository();
var settings = Substitute.For<StorageAccountSettings>();
var tableServiceClient = Substitute.For<TableServiceClient>();
var repository = new AdminEventRepository(tableServiceClient, settings);

// Act
Func<Task> func = async () => await repository.GetEvents();
Expand All @@ -53,8 +64,10 @@ public void Given_Instance_When_GetEvents_Invoked_Then_It_Should_Throw_Exception
public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception()
{
// Arrange
var settings = Substitute.For<StorageAccountSettings>();
var tableServiceClient = Substitute.For<TableServiceClient>();
var eventId = Guid.NewGuid();
var repository = new AdminEventRepository();
var repository = new AdminEventRepository(tableServiceClient, settings);

// Act
Func<Task> func = async () => await repository.GetEvent(eventId);
Expand All @@ -67,9 +80,11 @@ public void Given_Instance_When_GetEvent_Invoked_Then_It_Should_Throw_Exception(
public void Given_Instance_When_UpdateEvent_Invoked_Then_It_Should_Throw_Exception()
{
// Arrange
var settings = Substitute.For<StorageAccountSettings>();
var tableServiceClient = Substitute.For<TableServiceClient>();
var eventId = Guid.NewGuid();
var eventDetails = new AdminEventDetails();
var repository = new AdminEventRepository();
var repository = new AdminEventRepository(tableServiceClient, settings);

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

0 comments on commit 1393368

Please sign in to comment.