Skip to content

Commit 3e33f46

Browse files
committed
feat: Refactor GetInputFiles method to include applicationId and update solution file to include UnitTesting project
1 parent f212107 commit 3e33f46

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Modules/Intent.Modules.AI.UnitTests/Tasks/GenerateIntegrationEventHandlerUnitTestsWithAITask.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public string Execute(params string[] args)
7575
throw new Exception($"An element was selected to be executed upon but could not be found. Please ensure you have saved your designer and try again.");
7676
}
7777

78-
var inputFiles = GetInputFiles(eventHandlerElement);
78+
var inputFiles = GetInputFiles(applicationId, eventHandlerElement);
7979
Logging.Log.Info($"Context files included: {inputFiles.Count} files");
8080
Logging.Log.Debug($"Files: {string.Join(", ", inputFiles.Select(f => Path.GetFileName(f.FilePath)))}");
8181

@@ -532,7 +532,7 @@ await Assert.ThrowsAsync<NotFoundException>(
532532
return promptTemplate;
533533
}
534534

535-
private List<ICodebaseFile> GetInputFiles(IElement eventHandlerElement)
535+
private List<ICodebaseFile> GetInputFiles(string applicationId, IElement eventHandlerElement)
536536
{
537537
var filesProvider = _applicationConfigurationProvider.GeneratedFilesProvider();
538538

@@ -544,7 +544,7 @@ private List<ICodebaseFile> GetInputFiles(IElement eventHandlerElement)
544544
var handlerContent = string.Join("\n", handlerFiles.Select(f => f.Content));
545545

546546
// PRIMARY: Integration event message (the incoming message type)
547-
if (eventHandlerElement.TypeReference.ElementId != null)
547+
if (eventHandlerElement.TypeReference?.ElementId != null)
548548
{
549549
inputFiles.AddRange(filesProvider.GetFilesForMetadata(eventHandlerElement.TypeReference.Element));
550550
}
@@ -584,7 +584,7 @@ private List<ICodebaseFile> GetInputFiles(IElement eventHandlerElement)
584584
foreach (var messageTypeName in publishedMessageTypes)
585585
{
586586
// Try to find the message by scanning for matching elements in Services metadata
587-
var allElements = _metadataManager.Services(eventHandlerElement.Package.Id).Elements;
587+
var allElements = _metadataManager.Services(applicationId).Elements;
588588
var messageElement = allElements.FirstOrDefault(e => e.Name.Equals(messageTypeName, StringComparison.Ordinal));
589589
if (messageElement != null)
590590
{

Modules/Intent.Modules.NET.AI.slnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"Intent.Modules.AI.Blazor\\Intent.Modules.AI.Blazor.csproj",
88
"Intent.Modules.AI.ChatDrivenDomain\\Intent.Modules.AI.ChatDrivenDomain.csproj",
99
"Intent.Modules.AI.UnitTests\\Intent.Modules.AI.UnitTests.csproj",
10+
"Intent.Modules.UnitTesting\\Intent.Modules.UnitTesting.csproj"
1011
]
1112
}
1213
}

0 commit comments

Comments
 (0)