mirror of https://github.com/abpframework/abp.git
Browse Source
Added transient registration for IChatClientAccessor<> in AbpAIModule. Updated ChatClientAccessor to implement ITransientDependency and removed TryRegister from dependency attribute. Introduced unit tests for ChatClientAccessor resolution and behavior. Adjusted MockChatClient's StreamingResponseParts constant for test consistency.pull/23895/head
4 changed files with 51 additions and 5 deletions
@ -0,0 +1,47 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using Shouldly; |
||||
|
using Volo.Abp.AI.Tests.Workspaces; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.Testing; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.AI; |
||||
|
public class ChatClientAccessor_Tests : AbpIntegratedTest<AbpAITestModule> |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void Should_Resolve_DefaultChatClientAccessor() |
||||
|
{ |
||||
|
// Arrange & Act
|
||||
|
var chatClientAccessor = GetRequiredService<IChatClientAccessor>(); |
||||
|
// Assert
|
||||
|
chatClientAccessor.ShouldNotBeNull(); |
||||
|
chatClientAccessor.ChatClient.ShouldNotBeNull(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void Should_Resolve_ChatClientAccessor_For_Workspace() |
||||
|
{ |
||||
|
// Arrange & Act
|
||||
|
var chatClientAccessor = GetRequiredService<IChatClientAccessor<WordCounter>>(); |
||||
|
// Assert
|
||||
|
chatClientAccessor.ShouldNotBeNull(); |
||||
|
chatClientAccessor.ChatClient.ShouldNotBeNull(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void Should_Resolve_ChatClientAccessor_For_NonConfigured_Workspace() |
||||
|
{ |
||||
|
// Arrange & Act
|
||||
|
var chatClientAccessor = GetRequiredService<IChatClientAccessor<NonConfiguredWorkspace>>(); |
||||
|
|
||||
|
// Assert
|
||||
|
chatClientAccessor.ShouldNotBeNull(); |
||||
|
chatClientAccessor.ChatClient.ShouldBeNull(); |
||||
|
} |
||||
|
|
||||
|
public class NonConfiguredWorkspace |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue