11using MaIN . Core . Hub . Contexts ;
22using MaIN . Domain . Entities ;
33using MaIN . Domain . Entities . Agents ;
4- using MaIN . Services . Services . Abstract ;
5- using Moq ;
64using MaIN . Domain . Entities . Agents . AgentSource ;
75using MaIN . Domain . Entities . Agents . Knowledge ;
86using MaIN . Domain . Exceptions . Flows ;
7+ using MaIN . Domain . Models . Abstract ;
8+ using MaIN . Services . Services . Abstract ;
9+ using Moq ;
910
1011namespace MaIN . Core . UnitTests ;
1112
@@ -14,12 +15,15 @@ public class FlowContextTests
1415 private readonly Mock < IAgentFlowService > _mockFlowService ;
1516 private readonly Mock < IAgentService > _mockAgentService ;
1617 private FlowContext _flowContext ;
18+ private readonly string _testModelId = "test-model" ;
1719
1820 public FlowContextTests ( )
1921 {
2022 _mockFlowService = new Mock < IAgentFlowService > ( ) ;
2123 _mockAgentService = new Mock < IAgentService > ( ) ;
2224 _flowContext = new FlowContext ( _mockFlowService . Object , _mockAgentService . Object ) ;
25+ var testModel = new GenericLocalModel ( _testModelId ) ;
26+ ModelRegistry . RegisterOrReplace ( testModel ) ;
2327 }
2428
2529 [ Fact ]
@@ -92,7 +96,7 @@ public async Task ProcessAsync_WithStringMessage_ShouldReturnChatResult()
9296 _flowContext . AddAgent ( firstAgent ) ;
9397
9498 var message = "Hello, flow!" ;
95- var chat = new Chat { Id = firstAgent . Id , Messages = new List < Message > ( ) , ModelId = "default" , Name = "test" } ;
99+ var chat = new Chat { Id = firstAgent . Id , Messages = new List < Message > ( ) , ModelId = _testModelId , Name = "test" } ;
96100
97101 _mockAgentService
98102 . Setup ( s => s . GetChatByAgent ( firstAgent . Id ) )
@@ -101,7 +105,7 @@ public async Task ProcessAsync_WithStringMessage_ShouldReturnChatResult()
101105 _mockAgentService
102106 . Setup ( s => s . Process ( It . IsAny < Chat > ( ) , firstAgent . Id , It . IsAny < Knowledge > ( ) , It . IsAny < bool > ( ) , null , null ) )
103107 . ReturnsAsync ( new Chat {
104- ModelId = "test-model" ,
108+ ModelId = _testModelId ,
105109 Name = "test" ,
106110 Messages = new List < Message > {
107111 new ( ) { Content = "Response" , Role = "Assistant" , Type = MessageType . LocalLLM }
@@ -113,7 +117,7 @@ public async Task ProcessAsync_WithStringMessage_ShouldReturnChatResult()
113117
114118 // Assert
115119 Assert . True ( result . Done ) ;
116- Assert . Equal ( "test-model" , result . Model ) ;
120+ Assert . Equal ( _testModelId , result . Model ) ;
117121 Assert . NotNull ( result . Message ) ;
118122 }
119123
0 commit comments