Skip to content

Commit b652d54

Browse files
committed
Fixed warnings
1 parent 6971ceb commit b652d54

14 files changed

Lines changed: 30 additions & 30 deletions

‎dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLKernelBuilderExtensionsTests.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class AzureCosmosDBNoSQLKernelBuilderExtensionsTests
2323
public void AddVectorStoreRegistersClass()
2424
{
2525
// Arrange
26-
this._kernelBuilder.Services.AddSingleton<Database>(Mock.Of<Database>());
26+
this._kernelBuilder.Services.AddSingleton<Database>(Mock.Of<Database>(MockBehavior.Loose));
2727

2828
// Act
2929
this._kernelBuilder.AddAzureCosmosDBNoSQLVectorStore();
@@ -55,7 +55,7 @@ public void AddVectorStoreWithConnectionStringRegistersClass()
5555
public void AddVectorStoreRecordCollectionRegistersClass()
5656
{
5757
// Arrange
58-
this._kernelBuilder.Services.AddSingleton<Database>(Mock.Of<Database>());
58+
this._kernelBuilder.Services.AddSingleton<Database>(Mock.Of<Database>(MockBehavior.Loose));
5959

6060
// Act
6161
this._kernelBuilder.AddAzureCosmosDBNoSQLVectorStoreRecordCollection<TestRecord>("testcollection");

‎dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLServiceCollectionExtensionsTests.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed class AzureCosmosDBNoSQLServiceCollectionExtensionsTests
2323
public void AddVectorStoreRegistersClass()
2424
{
2525
// Arrange
26-
this._serviceCollection.AddSingleton<Database>(Mock.Of<Database>());
26+
this._serviceCollection.AddSingleton<Database>(Mock.Of<Database>(MockBehavior.Loose));
2727

2828
// Act
2929
this._serviceCollection.AddAzureCosmosDBNoSQLVectorStore();
@@ -56,7 +56,7 @@ public void AddVectorStoreWithConnectionStringRegistersClass()
5656
public void AddVectorStoreRecordCollectionRegistersClass()
5757
{
5858
// Arrange
59-
this._serviceCollection.AddSingleton<Database>(Mock.Of<Database>());
59+
this._serviceCollection.AddSingleton<Database>(Mock.Of<Database>(MockBehavior.Loose));
6060

6161
// Act
6262
this._serviceCollection.AddAzureCosmosDBNoSQLVectorStoreRecordCollection<TestRecord>("testcollection");

‎dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace SemanticKernel.Connectors.AzureCosmosDBNoSQL.UnitTests;
2121
/// </summary>
2222
public sealed class AzureCosmosDBNoSQLVectorStoreRecordCollectionTests
2323
{
24-
private readonly Mock<Database> _mockDatabase = new();
25-
private readonly Mock<Container> _mockContainer = new();
24+
private readonly Mock<Database> _mockDatabase = new(MockBehavior.Loose);
25+
private readonly Mock<Container> _mockContainer = new(MockBehavior.Loose);
2626

2727
public AzureCosmosDBNoSQLVectorStoreRecordCollectionTests()
2828
{
@@ -74,12 +74,12 @@ public void ConstructorWithImperativeModelInitializesCollection()
7474
public async Task CollectionExistsReturnsValidResultAsync(List<string> collections, string collectionName, bool expectedResult)
7575
{
7676
// Arrange
77-
var mockFeedResponse = new Mock<FeedResponse<string>>();
77+
var mockFeedResponse = new Mock<FeedResponse<string>>(MockBehavior.Loose);
7878
mockFeedResponse
7979
.Setup(l => l.Resource)
8080
.Returns(collections);
8181

82-
var mockFeedIterator = new Mock<FeedIterator<string>>();
82+
var mockFeedIterator = new Mock<FeedIterator<string>>(MockBehavior.Loose);
8383
mockFeedIterator
8484
.SetupSequence(l => l.HasMoreResults)
8585
.Returns(true)
@@ -194,7 +194,7 @@ public async Task CreateCollectionIfNotExistsInvokesValidMethodsAsync(List<strin
194194
// Arrange
195195
const string CollectionName = "collection";
196196

197-
var mockFeedResponse = new Mock<FeedResponse<string>>();
197+
var mockFeedResponse = new Mock<FeedResponse<string>>(MockBehavior.Loose);
198198
mockFeedResponse
199199
.Setup(l => l.Resource)
200200
.Returns(collections);

‎dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace SemanticKernel.Connectors.AzureCosmosDBNoSQL.UnitTests;
1818
/// </summary>
1919
public sealed class AzureCosmosDBNoSQLVectorStoreTests
2020
{
21-
private readonly Mock<Database> _mockDatabase = new();
21+
private readonly Mock<Database> _mockDatabase = new(MockBehavior.Loose);
2222

2323
[Fact]
2424
public void GetCollectionWithNotSupportedKeyThrowsException()

‎dotnet/src/Connectors/Connectors.HuggingFace.UnitTests/HuggingFaceTestHelper.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal static ReadOnlyMemory<byte> GetTestResponseBytes(string fileName)
3535
/// <param name="httpResponseMessage">Message to return for mocked <see cref="HttpClientHandler"/>.</param>
3636
internal static HttpClientHandler GetHttpClientHandlerMock(HttpResponseMessage httpResponseMessage)
3737
{
38-
var httpClientHandler = new Mock<HttpClientHandler>();
38+
var httpClientHandler = new Mock<HttpClientHandler>(MockBehavior.Loose);
3939

4040
httpClientHandler
4141
.Protected()

‎dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantMemoryBuilderExtensionsTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public QdrantMemoryBuilderExtensionsTests()
2929
public async Task QdrantMemoryStoreShouldBeProperlyInitializedAsync()
3030
{
3131
// Arrange
32-
var embeddingGenerationMock = Mock.Of<ITextEmbeddingGenerationService>();
32+
var embeddingGenerationMock = Mock.Of<ITextEmbeddingGenerationService>(MockBehavior.Loose);
3333

3434
this._httpClient.BaseAddress = new Uri("https://fake-random-qdrant-host");
3535
this._messageHandlerStub.ResponseToReturn.Content = new StringContent("""{"result":{"collections":[]}}""", Encoding.UTF8, MediaTypeNames.Application.Json);

‎dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantMemoryStoreTests.cs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ public class QdrantMemoryStoreTests
3131
private readonly ReadOnlyMemory<float> _embedding = new float[] { 1, 1, 1 };
3232
private readonly ReadOnlyMemory<float> _embedding2 = new float[] { 2, 2, 2 };
3333
private readonly ReadOnlyMemory<float> _embedding3 = new float[] { 3, 3, 3 };
34-
private readonly Mock<ILoggerFactory> _mockLoggerFactory = new();
34+
private readonly Mock<ILoggerFactory> _mockLoggerFactory = new(MockBehavior.Loose);
3535

3636
public QdrantMemoryStoreTests()
3737
{
3838
this._mockLoggerFactory
3939
.Setup(f => f.CreateLogger(It.IsAny<string>()))
40-
.Returns(new Mock<ILogger>().Object);
40+
.Returns(new Mock<ILogger>(MockBehavior.Loose).Object);
4141
}
4242

4343
[Fact]
4444
public async Task ItCreatesNewCollectionAsync()
4545
{
4646
// Arrange
47-
var mockQdrantClient = new Mock<IQdrantVectorDbClient>();
47+
var mockQdrantClient = new Mock<IQdrantVectorDbClient>(MockBehavior.Loose);
4848
mockQdrantClient
4949
.Setup<Task<bool>>(x => x.DoesCollectionExistAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
5050
.ReturnsAsync(false);
@@ -67,7 +67,7 @@ public async Task ItCreatesNewCollectionAsync()
6767
public async Task ItWillNotOverwriteExistingCollectionAsync()
6868
{
6969
// Arrange
70-
var mockQdrantClient = new Mock<IQdrantVectorDbClient>();
70+
var mockQdrantClient = new Mock<IQdrantVectorDbClient>(MockBehavior.Loose);
7171
mockQdrantClient
7272
.Setup<Task<bool>>(x => x.DoesCollectionExistAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
7373
.ReturnsAsync(true);
@@ -90,7 +90,7 @@ public async Task ItWillNotOverwriteExistingCollectionAsync()
9090
public async Task ItListsCollectionsAsync()
9191
{
9292
// Arrange
93-
var mockQdrantClient = new Mock<IQdrantVectorDbClient>();
93+
var mockQdrantClient = new Mock<IQdrantVectorDbClient>(MockBehavior.Loose);
9494
mockQdrantClient
9595
.Setup<IAsyncEnumerable<string>>(x => x.ListCollectionsAsync(It.IsAny<CancellationToken>()))
9696
.Returns((new string[] { "test1", "test2" }).ToAsyncEnumerable());
@@ -111,7 +111,7 @@ public async Task ItListsCollectionsAsync()
111111
public async Task ItDeletesCollectionAsync()
112112
{
113113
// Arrange
114-
var mockQdrantClient = new Mock<IQdrantVectorDbClient>();
114+
var mockQdrantClient = new Mock<IQdrantVectorDbClient>(MockBehavior.Loose);
115115
mockQdrantClient
116116
.Setup<Task>(x => x.DeleteCollectionAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()));
117117
mockQdrantClient
@@ -137,7 +137,7 @@ public async Task ItThrowsIfUpsertRequestFailsAsync()
137137
description: this._description,
138138
embedding: this._embedding);
139139

140-
var mockQdrantClient = new Mock<IQdrantVectorDbClient>();
140+
var mockQdrantClient = new Mock<IQdrantVectorDbClient>(MockBehavior.Loose);
141141
mockQdrantClient
142142
.Setup<Task<bool>>(x => x.DoesCollectionExistAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
143143
.ReturnsAsync(false);

‎dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantMemoryStoreTests2.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class QdrantMemoryStoreTests2
3030
private readonly ReadOnlyMemory<float> _embedding = new float[] { 1, 1, 1 };
3131
private readonly ReadOnlyMemory<float> _embedding2 = new float[] { 2, 2, 2 };
3232
private readonly ReadOnlyMemory<float> _embedding3 = new float[] { 3, 3, 3 };
33-
private readonly Mock<ILoggerFactory> _mockLogger = new();
33+
private readonly Mock<ILoggerFactory> _mockLogger = new(MockBehavior.Loose);
3434

3535
[Fact]
3636
public async Task GetAsyncCallsDoNotRequestVectorsUnlessSpecifiedAsync()

‎dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantMemoryStoreTests3.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class QdrantMemoryStoreTests3
2626
private readonly string _text = "text";
2727
private readonly string _description = "description";
2828
private readonly ReadOnlyMemory<float> _embedding = new float[] { 1, 1, 1 };
29-
private readonly Mock<ILoggerFactory> _mockLoggerFactory = new();
29+
private readonly Mock<ILoggerFactory> _mockLoggerFactory = new(MockBehavior.Loose);
3030

3131
[Fact]
3232
public async Task GetNearestMatchesAsyncCallsDoNotReturnVectorsUnlessSpecifiedAsync()

‎dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public RedisHashSetVectorStoreRecordCollectionTests()
2929
{
3030
this._redisDatabaseMock = new Mock<IDatabase>(MockBehavior.Strict);
3131

32-
var batchMock = new Mock<IBatch>();
32+
var batchMock = new Mock<IBatch>(MockBehavior.Loose);
3333
this._redisDatabaseMock.Setup(x => x.CreateBatch(It.IsAny<object>())).Returns(batchMock.Object);
3434
}
3535

0 commit comments

Comments
 (0)