fix tests
This commit is contained in:
@@ -392,7 +392,7 @@ public class AIResponseConstantsTests
|
|||||||
_ => typeof(object),
|
_ => typeof(object),
|
||||||
};
|
};
|
||||||
|
|
||||||
emptyMarkerType.Should().Be(typeof(string));
|
emptyMarkerType.Should().Be<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -345,28 +345,28 @@ public class ChatTypesTests
|
|||||||
"private" => typeof(string),
|
"private" => typeof(string),
|
||||||
_ => typeof(object),
|
_ => typeof(object),
|
||||||
};
|
};
|
||||||
privateType.Should().Be(typeof(string));
|
privateType.Should().Be<string>();
|
||||||
|
|
||||||
var groupType = ChatTypes.Group switch
|
var groupType = ChatTypes.Group switch
|
||||||
{
|
{
|
||||||
"group" => typeof(string),
|
"group" => typeof(string),
|
||||||
_ => typeof(object),
|
_ => typeof(object),
|
||||||
};
|
};
|
||||||
groupType.Should().Be(typeof(string));
|
groupType.Should().Be<string>();
|
||||||
|
|
||||||
var superGroupType = ChatTypes.SuperGroup switch
|
var superGroupType = ChatTypes.SuperGroup switch
|
||||||
{
|
{
|
||||||
"supergroup" => typeof(string),
|
"supergroup" => typeof(string),
|
||||||
_ => typeof(object),
|
_ => typeof(object),
|
||||||
};
|
};
|
||||||
superGroupType.Should().Be(typeof(string));
|
superGroupType.Should().Be<string>();
|
||||||
|
|
||||||
var channelType = ChatTypes.Channel switch
|
var channelType = ChatTypes.Channel switch
|
||||||
{
|
{
|
||||||
"channel" => typeof(string),
|
"channel" => typeof(string),
|
||||||
_ => typeof(object),
|
_ => typeof(object),
|
||||||
};
|
};
|
||||||
channelType.Should().Be(typeof(string));
|
channelType.Should().Be<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -22,72 +22,72 @@ public class IChatSessionRepositoryTests : UnitTestBase
|
|||||||
// GetOrCreateAsync method
|
// GetOrCreateAsync method
|
||||||
var getOrCreateAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetOrCreateAsync");
|
var getOrCreateAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetOrCreateAsync");
|
||||||
getOrCreateAsyncMethod.Should().NotBeNull();
|
getOrCreateAsyncMethod.Should().NotBeNull();
|
||||||
getOrCreateAsyncMethod!.ReturnType.Should().Be(typeof(Task<ChatSessionEntity>));
|
getOrCreateAsyncMethod!.ReturnType.Should().Be<Task<ChatSessionEntity>>();
|
||||||
getOrCreateAsyncMethod.GetParameters().Should().HaveCount(3);
|
getOrCreateAsyncMethod.GetParameters().Should().HaveCount(3);
|
||||||
getOrCreateAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
getOrCreateAsyncMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
getOrCreateAsyncMethod.GetParameters()[1].ParameterType.Should().Be(typeof(string));
|
getOrCreateAsyncMethod.GetParameters()[1].ParameterType.Should().Be<string>();
|
||||||
getOrCreateAsyncMethod.GetParameters()[2].ParameterType.Should().Be(typeof(string));
|
getOrCreateAsyncMethod.GetParameters()[2].ParameterType.Should().Be<string>();
|
||||||
|
|
||||||
// GetByChatIdAsync method
|
// GetByChatIdAsync method
|
||||||
var getByChatIdAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetByChatIdAsync");
|
var getByChatIdAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetByChatIdAsync");
|
||||||
getByChatIdAsyncMethod.Should().NotBeNull();
|
getByChatIdAsyncMethod.Should().NotBeNull();
|
||||||
getByChatIdAsyncMethod!.ReturnType.Should().Be(typeof(Task<ChatSessionEntity?>));
|
getByChatIdAsyncMethod!.ReturnType.Should().Be<Task<ChatSessionEntity?>>();
|
||||||
getByChatIdAsyncMethod.GetParameters().Should().HaveCount(1);
|
getByChatIdAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
getByChatIdAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
getByChatIdAsyncMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
|
|
||||||
// GetBySessionIdAsync method
|
// GetBySessionIdAsync method
|
||||||
var getBySessionIdAsyncMethod = methods.FirstOrDefault(m =>
|
var getBySessionIdAsyncMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "GetBySessionIdAsync"
|
m.Name == "GetBySessionIdAsync"
|
||||||
);
|
);
|
||||||
getBySessionIdAsyncMethod.Should().NotBeNull();
|
getBySessionIdAsyncMethod.Should().NotBeNull();
|
||||||
getBySessionIdAsyncMethod!.ReturnType.Should().Be(typeof(Task<ChatSessionEntity?>));
|
getBySessionIdAsyncMethod!.ReturnType.Should().Be<Task<ChatSessionEntity?>>();
|
||||||
getBySessionIdAsyncMethod.GetParameters().Should().HaveCount(1);
|
getBySessionIdAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
getBySessionIdAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(string));
|
getBySessionIdAsyncMethod.GetParameters()[0].ParameterType.Should().Be<string>();
|
||||||
|
|
||||||
// UpdateAsync method
|
// UpdateAsync method
|
||||||
var updateAsyncMethod = methods.FirstOrDefault(m => m.Name == "UpdateAsync");
|
var updateAsyncMethod = methods.FirstOrDefault(m => m.Name == "UpdateAsync");
|
||||||
updateAsyncMethod.Should().NotBeNull();
|
updateAsyncMethod.Should().NotBeNull();
|
||||||
updateAsyncMethod!.ReturnType.Should().Be(typeof(Task<ChatSessionEntity>));
|
updateAsyncMethod!.ReturnType.Should().Be<Task<ChatSessionEntity>>();
|
||||||
updateAsyncMethod.GetParameters().Should().HaveCount(1);
|
updateAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
updateAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(ChatSessionEntity));
|
updateAsyncMethod.GetParameters()[0].ParameterType.Should().Be<ChatSessionEntity>();
|
||||||
|
|
||||||
// DeleteAsync method
|
// DeleteAsync method
|
||||||
var deleteAsyncMethod = methods.FirstOrDefault(m => m.Name == "DeleteAsync");
|
var deleteAsyncMethod = methods.FirstOrDefault(m => m.Name == "DeleteAsync");
|
||||||
deleteAsyncMethod.Should().NotBeNull();
|
deleteAsyncMethod.Should().NotBeNull();
|
||||||
deleteAsyncMethod!.ReturnType.Should().Be(typeof(Task<bool>));
|
deleteAsyncMethod!.ReturnType.Should().Be<Task<bool>>();
|
||||||
deleteAsyncMethod.GetParameters().Should().HaveCount(1);
|
deleteAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
deleteAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
deleteAsyncMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
|
|
||||||
// GetMessagesAsync method
|
// GetMessagesAsync method
|
||||||
var getMessagesAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetMessagesAsync");
|
var getMessagesAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetMessagesAsync");
|
||||||
getMessagesAsyncMethod.Should().NotBeNull();
|
getMessagesAsyncMethod.Should().NotBeNull();
|
||||||
getMessagesAsyncMethod!.ReturnType.Should().Be(typeof(Task<List<ChatMessageEntity>>));
|
getMessagesAsyncMethod!.ReturnType.Should().Be<Task<List<ChatMessageEntity>>>();
|
||||||
getMessagesAsyncMethod.GetParameters().Should().HaveCount(1);
|
getMessagesAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
getMessagesAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
getMessagesAsyncMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
|
|
||||||
// AddMessageAsync method
|
// AddMessageAsync method
|
||||||
var addMessageAsyncMethod = methods.FirstOrDefault(m => m.Name == "AddMessageAsync");
|
var addMessageAsyncMethod = methods.FirstOrDefault(m => m.Name == "AddMessageAsync");
|
||||||
addMessageAsyncMethod.Should().NotBeNull();
|
addMessageAsyncMethod.Should().NotBeNull();
|
||||||
addMessageAsyncMethod!.ReturnType.Should().Be(typeof(Task<ChatMessageEntity>));
|
addMessageAsyncMethod!.ReturnType.Should().Be<Task<ChatMessageEntity>>();
|
||||||
addMessageAsyncMethod.GetParameters().Should().HaveCount(4);
|
addMessageAsyncMethod.GetParameters().Should().HaveCount(4);
|
||||||
addMessageAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
addMessageAsyncMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
addMessageAsyncMethod.GetParameters()[1].ParameterType.Should().Be(typeof(string));
|
addMessageAsyncMethod.GetParameters()[1].ParameterType.Should().Be<string>();
|
||||||
addMessageAsyncMethod.GetParameters()[2].ParameterType.Should().Be(typeof(string));
|
addMessageAsyncMethod.GetParameters()[2].ParameterType.Should().Be<string>();
|
||||||
addMessageAsyncMethod.GetParameters()[3].ParameterType.Should().Be(typeof(int));
|
addMessageAsyncMethod.GetParameters()[3].ParameterType.Should().Be<int>();
|
||||||
|
|
||||||
// ClearMessagesAsync method
|
// ClearMessagesAsync method
|
||||||
var clearMessagesAsyncMethod = methods.FirstOrDefault(m => m.Name == "ClearMessagesAsync");
|
var clearMessagesAsyncMethod = methods.FirstOrDefault(m => m.Name == "ClearMessagesAsync");
|
||||||
clearMessagesAsyncMethod.Should().NotBeNull();
|
clearMessagesAsyncMethod.Should().NotBeNull();
|
||||||
clearMessagesAsyncMethod!.ReturnType.Should().Be(typeof(Task));
|
clearMessagesAsyncMethod!.ReturnType.Should().Be<Task>();
|
||||||
clearMessagesAsyncMethod.GetParameters().Should().HaveCount(1);
|
clearMessagesAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
clearMessagesAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
clearMessagesAsyncMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
|
|
||||||
// GetActiveSessionsCountAsync method
|
// GetActiveSessionsCountAsync method
|
||||||
var getActiveSessionsCountAsyncMethod = methods.FirstOrDefault(m =>
|
var getActiveSessionsCountAsyncMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "GetActiveSessionsCountAsync"
|
m.Name == "GetActiveSessionsCountAsync"
|
||||||
);
|
);
|
||||||
getActiveSessionsCountAsyncMethod.Should().NotBeNull();
|
getActiveSessionsCountAsyncMethod.Should().NotBeNull();
|
||||||
getActiveSessionsCountAsyncMethod!.ReturnType.Should().Be(typeof(Task<int>));
|
getActiveSessionsCountAsyncMethod!.ReturnType.Should().Be<Task<int>>();
|
||||||
getActiveSessionsCountAsyncMethod.GetParameters().Should().BeEmpty();
|
getActiveSessionsCountAsyncMethod.GetParameters().Should().BeEmpty();
|
||||||
|
|
||||||
// CleanupOldSessionsAsync method
|
// CleanupOldSessionsAsync method
|
||||||
@@ -95,20 +95,18 @@ public class IChatSessionRepositoryTests : UnitTestBase
|
|||||||
m.Name == "CleanupOldSessionsAsync"
|
m.Name == "CleanupOldSessionsAsync"
|
||||||
);
|
);
|
||||||
cleanupOldSessionsAsyncMethod.Should().NotBeNull();
|
cleanupOldSessionsAsyncMethod.Should().NotBeNull();
|
||||||
cleanupOldSessionsAsyncMethod!.ReturnType.Should().Be(typeof(Task<int>));
|
cleanupOldSessionsAsyncMethod!.ReturnType.Should().Be<Task<int>>();
|
||||||
cleanupOldSessionsAsyncMethod.GetParameters().Should().HaveCount(1);
|
cleanupOldSessionsAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
cleanupOldSessionsAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
cleanupOldSessionsAsyncMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
|
|
||||||
// GetSessionsForCleanupAsync method
|
// GetSessionsForCleanupAsync method
|
||||||
var getSessionsForCleanupAsyncMethod = methods.FirstOrDefault(m =>
|
var getSessionsForCleanupAsyncMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "GetSessionsForCleanupAsync"
|
m.Name == "GetSessionsForCleanupAsync"
|
||||||
);
|
);
|
||||||
getSessionsForCleanupAsyncMethod.Should().NotBeNull();
|
getSessionsForCleanupAsyncMethod.Should().NotBeNull();
|
||||||
getSessionsForCleanupAsyncMethod!
|
getSessionsForCleanupAsyncMethod!.ReturnType.Should().Be<Task<List<ChatSessionEntity>>>();
|
||||||
.ReturnType.Should()
|
|
||||||
.Be(typeof(Task<List<ChatSessionEntity>>));
|
|
||||||
getSessionsForCleanupAsyncMethod.GetParameters().Should().HaveCount(1);
|
getSessionsForCleanupAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
getSessionsForCleanupAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
getSessionsForCleanupAsyncMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -160,10 +160,10 @@ public class MigrationsTests : IDisposable
|
|||||||
var foreignKeys = chatMessageEntity.GetForeignKeys();
|
var foreignKeys = chatMessageEntity.GetForeignKeys();
|
||||||
foreignKeys.Should().HaveCount(1);
|
foreignKeys.Should().HaveCount(1);
|
||||||
|
|
||||||
var foreignKey = foreignKeys.First();
|
var foreignKey = foreignKeys[0];
|
||||||
foreignKey.PrincipalEntityType.Should().Be(chatSessionEntity);
|
foreignKey.PrincipalEntityType.Should().Be(chatSessionEntity);
|
||||||
foreignKey.Properties.Should().HaveCount(1);
|
foreignKey.Properties.Should().HaveCount(1);
|
||||||
foreignKey.Properties.First().Name.Should().Be("SessionId");
|
foreignKey.Properties[0].Name.Should().Be("SessionId");
|
||||||
foreignKey.DeleteBehavior.Should().Be(DeleteBehavior.Cascade);
|
foreignKey.DeleteBehavior.Should().Be(DeleteBehavior.Cascade);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,5 +330,6 @@ public class MigrationsTests : IDisposable
|
|||||||
{
|
{
|
||||||
_dbContext?.Dispose();
|
_dbContext?.Dispose();
|
||||||
_serviceProvider?.Dispose();
|
_serviceProvider?.Dispose();
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,31 +22,31 @@ public class IAIServiceTests : UnitTestBase
|
|||||||
m.Name == "GenerateChatCompletionAsync"
|
m.Name == "GenerateChatCompletionAsync"
|
||||||
);
|
);
|
||||||
generateChatCompletionMethod.Should().NotBeNull();
|
generateChatCompletionMethod.Should().NotBeNull();
|
||||||
generateChatCompletionMethod!.ReturnType.Should().Be(typeof(Task<string>));
|
generateChatCompletionMethod!.ReturnType.Should().Be<Task<string>>();
|
||||||
generateChatCompletionMethod.GetParameters().Should().HaveCount(2);
|
generateChatCompletionMethod.GetParameters().Should().HaveCount(2);
|
||||||
generateChatCompletionMethod
|
generateChatCompletionMethod
|
||||||
.GetParameters()[0]
|
.GetParameters()[0]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(List<ChatMessage>));
|
.Be<List<ChatMessage>>();
|
||||||
generateChatCompletionMethod
|
generateChatCompletionMethod
|
||||||
.GetParameters()[1]
|
.GetParameters()[1]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(CancellationToken));
|
.Be<CancellationToken>();
|
||||||
|
|
||||||
var generateChatCompletionWithCompressionMethod = methods.FirstOrDefault(m =>
|
var generateChatCompletionWithCompressionMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "GenerateChatCompletionWithCompressionAsync"
|
m.Name == "GenerateChatCompletionWithCompressionAsync"
|
||||||
);
|
);
|
||||||
generateChatCompletionWithCompressionMethod.Should().NotBeNull();
|
generateChatCompletionWithCompressionMethod.Should().NotBeNull();
|
||||||
generateChatCompletionWithCompressionMethod!.ReturnType.Should().Be(typeof(Task<string>));
|
generateChatCompletionWithCompressionMethod!.ReturnType.Should().Be<Task<string>>();
|
||||||
generateChatCompletionWithCompressionMethod.GetParameters().Should().HaveCount(2);
|
generateChatCompletionWithCompressionMethod.GetParameters().Should().HaveCount(2);
|
||||||
generateChatCompletionWithCompressionMethod
|
generateChatCompletionWithCompressionMethod
|
||||||
.GetParameters()[0]
|
.GetParameters()[0]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(List<ChatMessage>));
|
.Be<List<ChatMessage>>();
|
||||||
generateChatCompletionWithCompressionMethod
|
generateChatCompletionWithCompressionMethod
|
||||||
.GetParameters()[1]
|
.GetParameters()[1]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(CancellationToken));
|
.Be<CancellationToken>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -24,25 +24,25 @@ public class IHistoryCompressionServiceTests : UnitTestBase
|
|||||||
m.Name == "CompressHistoryAsync"
|
m.Name == "CompressHistoryAsync"
|
||||||
);
|
);
|
||||||
compressHistoryAsyncMethod.Should().NotBeNull();
|
compressHistoryAsyncMethod.Should().NotBeNull();
|
||||||
compressHistoryAsyncMethod!.ReturnType.Should().Be(typeof(Task<List<ChatMessage>>));
|
compressHistoryAsyncMethod!.ReturnType.Should().Be<Task<List<ChatMessage>>>();
|
||||||
compressHistoryAsyncMethod.GetParameters().Should().HaveCount(3);
|
compressHistoryAsyncMethod.GetParameters().Should().HaveCount(3);
|
||||||
compressHistoryAsyncMethod
|
compressHistoryAsyncMethod
|
||||||
.GetParameters()[0]
|
.GetParameters()[0]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(List<ChatMessage>));
|
.Be<List<ChatMessage>>();
|
||||||
compressHistoryAsyncMethod.GetParameters()[1].ParameterType.Should().Be(typeof(int));
|
compressHistoryAsyncMethod.GetParameters()[1].ParameterType.Should().Be<int>();
|
||||||
compressHistoryAsyncMethod
|
compressHistoryAsyncMethod
|
||||||
.GetParameters()[2]
|
.GetParameters()[2]
|
||||||
.ParameterType.Should()
|
.ParameterType.Should()
|
||||||
.Be(typeof(CancellationToken));
|
.Be<CancellationToken>();
|
||||||
|
|
||||||
// ShouldCompress method
|
// ShouldCompress method
|
||||||
var shouldCompressMethod = methods.FirstOrDefault(m => m.Name == "ShouldCompress");
|
var shouldCompressMethod = methods.FirstOrDefault(m => m.Name == "ShouldCompress");
|
||||||
shouldCompressMethod.Should().NotBeNull();
|
shouldCompressMethod.Should().NotBeNull();
|
||||||
shouldCompressMethod!.ReturnType.Should().Be(typeof(bool));
|
shouldCompressMethod!.ReturnType.Should().Be<bool>();
|
||||||
shouldCompressMethod.GetParameters().Should().HaveCount(2);
|
shouldCompressMethod.GetParameters().Should().HaveCount(2);
|
||||||
shouldCompressMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
shouldCompressMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
shouldCompressMethod.GetParameters()[1].ParameterType.Should().Be(typeof(int));
|
shouldCompressMethod.GetParameters()[1].ParameterType.Should().Be<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -25,23 +25,23 @@ public class IOllamaClientTests : UnitTestBase
|
|||||||
// SelectedModel property
|
// SelectedModel property
|
||||||
var selectedModelProperty = properties.FirstOrDefault(p => p.Name == "SelectedModel");
|
var selectedModelProperty = properties.FirstOrDefault(p => p.Name == "SelectedModel");
|
||||||
selectedModelProperty.Should().NotBeNull();
|
selectedModelProperty.Should().NotBeNull();
|
||||||
selectedModelProperty!.PropertyType.Should().Be(typeof(string));
|
selectedModelProperty!.PropertyType.Should().Be<string>();
|
||||||
selectedModelProperty.CanRead.Should().BeTrue();
|
selectedModelProperty.CanRead.Should().BeTrue();
|
||||||
selectedModelProperty.CanWrite.Should().BeTrue();
|
selectedModelProperty.CanWrite.Should().BeTrue();
|
||||||
|
|
||||||
// ChatAsync method
|
// ChatAsync method
|
||||||
var chatAsyncMethod = methods.FirstOrDefault(m => m.Name == "ChatAsync");
|
var chatAsyncMethod = methods.FirstOrDefault(m => m.Name == "ChatAsync");
|
||||||
chatAsyncMethod.Should().NotBeNull();
|
chatAsyncMethod.Should().NotBeNull();
|
||||||
chatAsyncMethod!.ReturnType.Should().Be(typeof(IAsyncEnumerable<ChatResponseStream?>));
|
chatAsyncMethod!.ReturnType.Should().Be<IAsyncEnumerable<ChatResponseStream?>>();
|
||||||
chatAsyncMethod.GetParameters().Should().HaveCount(1);
|
chatAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
chatAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(ChatRequest));
|
chatAsyncMethod.GetParameters()[0].ParameterType.Should().Be<ChatRequest>();
|
||||||
|
|
||||||
// ListLocalModelsAsync method
|
// ListLocalModelsAsync method
|
||||||
var listLocalModelsAsyncMethod = methods.FirstOrDefault(m =>
|
var listLocalModelsAsyncMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "ListLocalModelsAsync"
|
m.Name == "ListLocalModelsAsync"
|
||||||
);
|
);
|
||||||
listLocalModelsAsyncMethod.Should().NotBeNull();
|
listLocalModelsAsyncMethod.Should().NotBeNull();
|
||||||
listLocalModelsAsyncMethod!.ReturnType.Should().Be(typeof(Task<IEnumerable<Model>>));
|
listLocalModelsAsyncMethod!.ReturnType.Should().Be<Task<IEnumerable<Model>>>();
|
||||||
listLocalModelsAsyncMethod.GetParameters().Should().BeEmpty();
|
listLocalModelsAsyncMethod.GetParameters().Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,47 +22,47 @@ public class ISessionStorageTests : UnitTestBase
|
|||||||
// GetOrCreate method
|
// GetOrCreate method
|
||||||
var getOrCreateMethod = methods.FirstOrDefault(m => m.Name == "GetOrCreate");
|
var getOrCreateMethod = methods.FirstOrDefault(m => m.Name == "GetOrCreate");
|
||||||
getOrCreateMethod.Should().NotBeNull();
|
getOrCreateMethod.Should().NotBeNull();
|
||||||
getOrCreateMethod!.ReturnType.Should().Be(typeof(ChatSession));
|
getOrCreateMethod!.ReturnType.Should().Be<ChatSession>();
|
||||||
getOrCreateMethod.GetParameters().Should().HaveCount(3);
|
getOrCreateMethod.GetParameters().Should().HaveCount(3);
|
||||||
getOrCreateMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
getOrCreateMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
getOrCreateMethod.GetParameters()[1].ParameterType.Should().Be(typeof(string));
|
getOrCreateMethod.GetParameters()[1].ParameterType.Should().Be<string>();
|
||||||
getOrCreateMethod.GetParameters()[2].ParameterType.Should().Be(typeof(string));
|
getOrCreateMethod.GetParameters()[2].ParameterType.Should().Be<string>();
|
||||||
|
|
||||||
// Get method
|
// Get method
|
||||||
var getMethod = methods.FirstOrDefault(m => m.Name == "Get");
|
var getMethod = methods.FirstOrDefault(m => m.Name == "Get");
|
||||||
getMethod.Should().NotBeNull();
|
getMethod.Should().NotBeNull();
|
||||||
getMethod!.ReturnType.Should().Be(typeof(ChatSession));
|
getMethod!.ReturnType.Should().Be<ChatSession>();
|
||||||
getMethod.GetParameters().Should().HaveCount(1);
|
getMethod.GetParameters().Should().HaveCount(1);
|
||||||
getMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
getMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
|
|
||||||
// Remove method
|
// Remove method
|
||||||
var removeMethod = methods.FirstOrDefault(m => m.Name == "Remove");
|
var removeMethod = methods.FirstOrDefault(m => m.Name == "Remove");
|
||||||
removeMethod.Should().NotBeNull();
|
removeMethod.Should().NotBeNull();
|
||||||
removeMethod!.ReturnType.Should().Be(typeof(bool));
|
removeMethod!.ReturnType.Should().Be<bool>();
|
||||||
removeMethod.GetParameters().Should().HaveCount(1);
|
removeMethod.GetParameters().Should().HaveCount(1);
|
||||||
removeMethod.GetParameters()[0].ParameterType.Should().Be(typeof(long));
|
removeMethod.GetParameters()[0].ParameterType.Should().Be<long>();
|
||||||
|
|
||||||
// GetActiveSessionsCount method
|
// GetActiveSessionsCount method
|
||||||
var getActiveSessionsCountMethod = methods.FirstOrDefault(m =>
|
var getActiveSessionsCountMethod = methods.FirstOrDefault(m =>
|
||||||
m.Name == "GetActiveSessionsCount"
|
m.Name == "GetActiveSessionsCount"
|
||||||
);
|
);
|
||||||
getActiveSessionsCountMethod.Should().NotBeNull();
|
getActiveSessionsCountMethod.Should().NotBeNull();
|
||||||
getActiveSessionsCountMethod!.ReturnType.Should().Be(typeof(int));
|
getActiveSessionsCountMethod!.ReturnType.Should().Be<int>();
|
||||||
getActiveSessionsCountMethod.GetParameters().Should().BeEmpty();
|
getActiveSessionsCountMethod.GetParameters().Should().BeEmpty();
|
||||||
|
|
||||||
// CleanupOldSessions method
|
// CleanupOldSessions method
|
||||||
var cleanupOldSessionsMethod = methods.FirstOrDefault(m => m.Name == "CleanupOldSessions");
|
var cleanupOldSessionsMethod = methods.FirstOrDefault(m => m.Name == "CleanupOldSessions");
|
||||||
cleanupOldSessionsMethod.Should().NotBeNull();
|
cleanupOldSessionsMethod.Should().NotBeNull();
|
||||||
cleanupOldSessionsMethod!.ReturnType.Should().Be(typeof(int));
|
cleanupOldSessionsMethod!.ReturnType.Should().Be<int>();
|
||||||
cleanupOldSessionsMethod.GetParameters().Should().HaveCount(1);
|
cleanupOldSessionsMethod.GetParameters().Should().HaveCount(1);
|
||||||
cleanupOldSessionsMethod.GetParameters()[0].ParameterType.Should().Be(typeof(int));
|
cleanupOldSessionsMethod.GetParameters()[0].ParameterType.Should().Be<int>();
|
||||||
|
|
||||||
// SaveSessionAsync method
|
// SaveSessionAsync method
|
||||||
var saveSessionAsyncMethod = methods.FirstOrDefault(m => m.Name == "SaveSessionAsync");
|
var saveSessionAsyncMethod = methods.FirstOrDefault(m => m.Name == "SaveSessionAsync");
|
||||||
saveSessionAsyncMethod.Should().NotBeNull();
|
saveSessionAsyncMethod.Should().NotBeNull();
|
||||||
saveSessionAsyncMethod!.ReturnType.Should().Be(typeof(Task));
|
saveSessionAsyncMethod!.ReturnType.Should().Be<Task>();
|
||||||
saveSessionAsyncMethod.GetParameters().Should().HaveCount(1);
|
saveSessionAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
saveSessionAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(ChatSession));
|
saveSessionAsyncMethod.GetParameters()[0].ParameterType.Should().Be<ChatSession>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ public class ITelegramBotClientWrapperTests : UnitTestBase
|
|||||||
// GetMeAsync method
|
// GetMeAsync method
|
||||||
var getMeAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetMeAsync");
|
var getMeAsyncMethod = methods.FirstOrDefault(m => m.Name == "GetMeAsync");
|
||||||
getMeAsyncMethod.Should().NotBeNull();
|
getMeAsyncMethod.Should().NotBeNull();
|
||||||
getMeAsyncMethod!.ReturnType.Should().Be(typeof(Task<User>));
|
getMeAsyncMethod!.ReturnType.Should().Be<Task<User>>();
|
||||||
getMeAsyncMethod.GetParameters().Should().HaveCount(1);
|
getMeAsyncMethod.GetParameters().Should().HaveCount(1);
|
||||||
getMeAsyncMethod.GetParameters()[0].ParameterType.Should().Be(typeof(CancellationToken));
|
getMeAsyncMethod.GetParameters()[0].ParameterType.Should().Be<CancellationToken>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ public class TelegramBotClientWrapperTests : UnitTestBase
|
|||||||
// Act & Assert
|
// Act & Assert
|
||||||
var method = typeof(TelegramBotClientWrapper).GetMethod("GetMeAsync");
|
var method = typeof(TelegramBotClientWrapper).GetMethod("GetMeAsync");
|
||||||
method.Should().NotBeNull();
|
method.Should().NotBeNull();
|
||||||
method!.ReturnType.Should().Be(typeof(Task<User>));
|
method!.ReturnType.Should().Be<Task<User>>();
|
||||||
|
|
||||||
var parameters = method.GetParameters();
|
var parameters = method.GetParameters();
|
||||||
parameters.Should().HaveCount(1);
|
parameters.Should().HaveCount(1);
|
||||||
parameters[0].ParameterType.Should().Be(typeof(CancellationToken));
|
parameters[0].ParameterType.Should().Be<CancellationToken>();
|
||||||
parameters[0].HasDefaultValue.Should().BeTrue();
|
parameters[0].HasDefaultValue.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ public class TelegramBotClientWrapperTests : UnitTestBase
|
|||||||
var constructor = constructors[0];
|
var constructor = constructors[0];
|
||||||
var parameters = constructor.GetParameters();
|
var parameters = constructor.GetParameters();
|
||||||
parameters.Should().HaveCount(1);
|
parameters.Should().HaveCount(1);
|
||||||
parameters[0].ParameterType.Should().Be(typeof(ITelegramBotClient));
|
parameters[0].ParameterType.Should().Be<ITelegramBotClient>();
|
||||||
parameters[0].Name.Should().Be("botClient");
|
parameters[0].Name.Should().Be("botClient");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public class TelegramBotClientWrapperTests : UnitTestBase
|
|||||||
var wrapper = new TelegramBotClientWrapper(_botClientMock.Object);
|
var wrapper = new TelegramBotClientWrapper(_botClientMock.Object);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
wrapper.GetType().BaseType.Should().Be(typeof(object));
|
wrapper.GetType().BaseType.Should().Be<object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -179,11 +179,11 @@ public class TelegramBotClientWrapperTests : UnitTestBase
|
|||||||
// Assert
|
// Assert
|
||||||
interfaceMethods.Should().HaveCount(1);
|
interfaceMethods.Should().HaveCount(1);
|
||||||
interfaceMethods[0].Name.Should().Be("GetMeAsync");
|
interfaceMethods[0].Name.Should().Be("GetMeAsync");
|
||||||
interfaceMethods[0].ReturnType.Should().Be(typeof(Task<User>));
|
interfaceMethods[0].ReturnType.Should().Be<Task<User>>();
|
||||||
|
|
||||||
var parameters = interfaceMethods[0].GetParameters();
|
var parameters = interfaceMethods[0].GetParameters();
|
||||||
parameters.Should().HaveCount(1);
|
parameters.Should().HaveCount(1);
|
||||||
parameters[0].ParameterType.Should().Be(typeof(CancellationToken));
|
parameters[0].ParameterType.Should().Be<CancellationToken>();
|
||||||
parameters[0].HasDefaultValue.Should().BeTrue();
|
parameters[0].HasDefaultValue.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ public class TelegramBotClientWrapperTests : UnitTestBase
|
|||||||
// Act & Assert
|
// Act & Assert
|
||||||
getMeMethod.Should().NotBeNull();
|
getMeMethod.Should().NotBeNull();
|
||||||
var returnType = getMeMethod!.ReturnType;
|
var returnType = getMeMethod!.ReturnType;
|
||||||
returnType.Should().Be(typeof(Task<User>));
|
returnType.Should().Be<Task<User>>();
|
||||||
|
|
||||||
var attributes = returnType.GetCustomAttributes(false);
|
var attributes = returnType.GetCustomAttributes(false);
|
||||||
attributes.Should().NotBeNull();
|
attributes.Should().NotBeNull();
|
||||||
|
|||||||
Reference in New Issue
Block a user