fix issues
This commit is contained in:
@@ -173,9 +173,7 @@ public class HistoryCompressionServiceTests : UnitTestBase
|
||||
);
|
||||
}
|
||||
|
||||
private static IAsyncEnumerable<OllamaSharp.Models.Chat.ChatResponseStream> ThrowAsyncEnumerable(
|
||||
Exception exception
|
||||
)
|
||||
private static ThrowingAsyncEnumerable ThrowAsyncEnumerable(Exception exception)
|
||||
{
|
||||
return new ThrowingAsyncEnumerable(exception);
|
||||
}
|
||||
|
||||
@@ -37,10 +37,24 @@ public class ModelServiceTests : UnitTestBase
|
||||
public async Task InitializeAsync_ShouldLogModelInformation()
|
||||
{
|
||||
// Act
|
||||
await _modelService.InitializeAsync();
|
||||
var act = async () => await _modelService.InitializeAsync();
|
||||
|
||||
// Assert
|
||||
// The method should complete without throwing exceptions
|
||||
// In a real test, we might verify logging calls
|
||||
await act.Should()
|
||||
.NotThrowAsync("InitializeAsync should complete without throwing exceptions");
|
||||
|
||||
// Verify that logging was called (at least once for model information)
|
||||
_loggerMock.Verify(
|
||||
x =>
|
||||
x.Log(
|
||||
LogLevel.Information,
|
||||
It.IsAny<EventId>(),
|
||||
It.Is<It.IsAnyType>((v, t) => v.ToString()!.Contains("model")),
|
||||
It.IsAny<Exception>(),
|
||||
It.IsAny<Func<It.IsAnyType, Exception?, string>>()
|
||||
),
|
||||
Times.AtLeastOnce,
|
||||
"Should log model information"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,16 +156,16 @@ public static class TestDataBuilder
|
||||
.Returns<long, string, string>(
|
||||
(chatId, chatType, chatTitle) =>
|
||||
{
|
||||
if (!sessions.ContainsKey(chatId))
|
||||
if (!sessions.TryGetValue(chatId, out var session))
|
||||
{
|
||||
var session = TestDataBuilder.ChatSessions.CreateBasicSession(
|
||||
session = TestDataBuilder.ChatSessions.CreateBasicSession(
|
||||
chatId,
|
||||
chatType
|
||||
);
|
||||
session.ChatTitle = chatTitle;
|
||||
sessions[chatId] = session;
|
||||
}
|
||||
return sessions[chatId];
|
||||
return session;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user