fix issues
This commit is contained in:
@@ -173,9 +173,7 @@ public class HistoryCompressionServiceTests : UnitTestBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IAsyncEnumerable<OllamaSharp.Models.Chat.ChatResponseStream> ThrowAsyncEnumerable(
|
private static ThrowingAsyncEnumerable ThrowAsyncEnumerable(Exception exception)
|
||||||
Exception exception
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return new ThrowingAsyncEnumerable(exception);
|
return new ThrowingAsyncEnumerable(exception);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,24 @@ public class ModelServiceTests : UnitTestBase
|
|||||||
public async Task InitializeAsync_ShouldLogModelInformation()
|
public async Task InitializeAsync_ShouldLogModelInformation()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
await _modelService.InitializeAsync();
|
var act = async () => await _modelService.InitializeAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
// The method should complete without throwing exceptions
|
await act.Should()
|
||||||
// In a real test, we might verify logging calls
|
.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>(
|
.Returns<long, string, string>(
|
||||||
(chatId, chatType, chatTitle) =>
|
(chatId, chatType, chatTitle) =>
|
||||||
{
|
{
|
||||||
if (!sessions.ContainsKey(chatId))
|
if (!sessions.TryGetValue(chatId, out var session))
|
||||||
{
|
{
|
||||||
var session = TestDataBuilder.ChatSessions.CreateBasicSession(
|
session = TestDataBuilder.ChatSessions.CreateBasicSession(
|
||||||
chatId,
|
chatId,
|
||||||
chatType
|
chatType
|
||||||
);
|
);
|
||||||
session.ChatTitle = chatTitle;
|
session.ChatTitle = chatTitle;
|
||||||
sessions[chatId] = session;
|
sessions[chatId] = session;
|
||||||
}
|
}
|
||||||
return sessions[chatId];
|
return session;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user