Skip to content

Commit

Permalink
Merge pull request #55 from atc-net/feature/deps
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
rickykaare authored Apr 25, 2024
2 parents 353b405 + 3029d44 commit b4e5206
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 36 deletions.
9 changes: 3 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<PropertyGroup Label="Compile settings">
<Nullable>enable</Nullable>
<LangVersion>9.0</LangVersion>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1573,1591,1712</NoWarn>

Expand All @@ -55,12 +55,9 @@

<!-- Shared code analyzers used for all projects in the solution -->
<ItemGroup Label="Code Analyzers">
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.5" PrivateAssets="all" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.43.0.51858" PrivateAssets="all" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.24.0.89429" PrivateAssets="all" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Atc.Cosmos/Atc.Cosmos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.35.1-preview" Condition="$(IsPreview)" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.35.1" Condition="!$(IsPreview)" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.39.1" Condition="!$(IsPreview)" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
Expand Down
4 changes: 2 additions & 2 deletions src/Atc.Cosmos/Internal/CosmosClientProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public CosmosClientProvider(
}

public CosmosClient GetClient(CosmosOptions options)
=> cosmosClientCache.AddOrUpdate(options, _ => CreateClient(options, allowBulk: false), (o, c) => c);
=> cosmosClientCache.AddOrUpdate(options, o => CreateClient(o, allowBulk: false), (o, c) => c);

public CosmosClient GetBulkClient(CosmosOptions options)
=> cosmosBulkClientCache.AddOrUpdate(options, _ => CreateClient(options, allowBulk: true), (o, c) => c);
=> cosmosBulkClientCache.AddOrUpdate(options, o => CreateClient(o, allowBulk: true), (o, c) => c);

public void Dispose()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Atc.Cosmos/Internal/CosmosContainerRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Options;

namespace Atc.Cosmos.Internal
Expand Down Expand Up @@ -41,7 +40,7 @@ public ICosmosContainerNameProvider GetContainerForType<TType>()
=> GetContainerForType(typeof(TType));

public ICosmosContainerNameProvider GetContainerForType(Type resourceType)
=> providers.FirstOrDefault(p => p.IsForType(resourceType))
=> providers.Find(p => p.IsForType(resourceType))
?? throw new NotSupportedException(
$"Type {resourceType.Name} is not supported.");

Expand Down
4 changes: 0 additions & 4 deletions src/Atc.Cosmos/Internal/CosmosInitializer.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Options;

namespace Atc.Cosmos.Internal
{
Expand All @@ -16,7 +14,6 @@ namespace Atc.Cosmos.Internal
public class CosmosInitializer : ICosmosInitializer
{
private readonly ICosmosClientProvider provider;
private readonly ICosmosContainerRegistry registry;
private readonly IReadOnlyDictionary<CosmosOptions, List<ICosmosContainerInitializer>> initializers;

public CosmosInitializer(
Expand All @@ -25,7 +22,6 @@ public CosmosInitializer(
ICosmosContainerRegistry registry)
{
this.provider = provider;
this.registry = registry;
this.initializers = initializers
.GroupBy(i => i.Scope ?? registry.DefaultOptions)
.ToDictionary(i => i.Key, i => i.Select(n => n.Initializer).ToList());
Expand Down
4 changes: 2 additions & 2 deletions src/Atc.Cosmos/Testing/FakeCosmosReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public virtual async IAsyncEnumerable<IEnumerable<TResult>> BatchQueryAsync<TRes
}
}

if (buffer.Any())
if (buffer.Count > 0)
{
yield return buffer.ToImmutableList();
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public virtual async IAsyncEnumerable<IEnumerable<TResult>> BatchCrossPartitionQ
}
}

if (buffer.Any())
if (buffer.Count > 0)
{
yield return buffer.ToImmutableList();
}
Expand Down
3 changes: 2 additions & 1 deletion test/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ dotnet_diagnostic.CA1812.severity = none # Test classes used as gener
dotnet_diagnostic.SA1202.severity = none # Private helper methods makes sense to keep at top of test classes, as tests are added to bottom.
dotnet_diagnostic.CA2201.severity = none # Instantiating Exceptions as test data should be allowed.
dotnet_diagnostic.MA0016.severity = none # Prefer return collection abstraction instead of implementation
dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists
dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists
dotnet_diagnostic.S6608.severity = none # S6608: Prefer indexing instead of "Enumerable" methods on types implementing "IList"
2 changes: 1 addition & 1 deletion test/Atc.Cosmos.Tests/Atc.Cosmos.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="AsyncEnumerator" Version="4.0.2" />
<PackageReference Include="Atc.Test" Version="1.0.66" />
<PackageReference Include="Atc.Test" Version="1.0.79" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
Expand Down
4 changes: 0 additions & 4 deletions test/Atc.Cosmos.Tests/CosmosBulkReaderBatchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
using Dasync.Collections;
using FluentAssertions;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Options;
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;

namespace Atc.Cosmos.Tests
{
public class CosmosBulkReaderBatchTests
{
private readonly CosmosOptions options;
private readonly ItemResponse<Record> itemResponse;
private readonly FeedIterator<Record> feedIterator;
private readonly FeedResponse<Record> feedResponse;
Expand All @@ -29,7 +26,6 @@ public class CosmosBulkReaderBatchTests
public CosmosBulkReaderBatchTests()
{
var fixture = FixtureFactory.Create();
options = fixture.Create<CosmosOptions>();
record = fixture.Create<Record>();
itemResponse = Substitute.For<ItemResponse<Record>>();
itemResponse
Expand Down
4 changes: 0 additions & 4 deletions test/Atc.Cosmos.Tests/CosmosReaderBatchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
using Dasync.Collections;
using FluentAssertions;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.Options;
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;

namespace Atc.Cosmos.Tests
{
public class CosmosReaderBatchTests
{
private readonly CosmosOptions options;
private readonly ItemResponse<Record> itemResponse;
private readonly FeedIterator<Record> feedIterator;
private readonly FeedResponse<Record> feedResponse;
Expand All @@ -29,7 +26,6 @@ public class CosmosReaderBatchTests
public CosmosReaderBatchTests()
{
var fixture = FixtureFactory.Create();
options = fixture.Create<CosmosOptions>();
record = fixture.Create<Record>();
itemResponse = Substitute.For<ItemResponse<Record>>();
itemResponse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Atc.Cosmos.DependencyInjection;
using Atc.Cosmos.Internal;
using Atc.Test;
using AutoFixture.AutoNSubstitute;
using AutoFixture.Xunit2;
using FluentAssertions;
using Microsoft.Azure.Cosmos;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -18,7 +16,7 @@ namespace Atc.Cosmos.Tests.DependencyInjection
{
public class CosmosBuilderTests
{
private class RecordInitializer : ICosmosContainerInitializer
private sealed class RecordInitializer : ICosmosContainerInitializer
{
public Task InitializeAsync(
Database database,
Expand Down
2 changes: 1 addition & 1 deletion test/Atc.Cosmos.Tests/Generators/FakeTokenCredential.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Atc.Cosmos.Tests.Generators
{
internal class FakeTokenCredential : TokenCredential
internal sealed class FakeTokenCredential : TokenCredential
{
private readonly AccessToken accessToken = new (
"token",
Expand Down
2 changes: 0 additions & 2 deletions test/Atc.Cosmos.Tests/LowPriorityCosmosReaderBatchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace Atc.Cosmos.Tests
{
public class LowPriorityCosmosReaderBatchTests
{
private readonly CosmosOptions options;
private readonly ItemResponse<Record> itemResponse;
private readonly FeedIterator<Record> feedIterator;
private readonly FeedResponse<Record> feedResponse;
Expand All @@ -28,7 +27,6 @@ public class LowPriorityCosmosReaderBatchTests
public LowPriorityCosmosReaderBatchTests()
{
var fixture = FixtureFactory.Create();
options = fixture.Create<CosmosOptions>();
record = fixture.Create<Record>();
itemResponse = Substitute.For<ItemResponse<Record>>();
itemResponse
Expand Down
3 changes: 1 addition & 2 deletions test/Atc.Cosmos.Tests/Testing/FakeCosmosReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Threading.Tasks;
using Atc.Cosmos.Testing;
using Atc.Test;
using AutoFixture;
using AutoFixture.Xunit2;
using Dasync.Collections;
using FluentAssertions;
Expand Down Expand Up @@ -327,7 +326,7 @@ public async Task PagedCrossPartitionQuery_Should_Return_All_Documents_When_Give
var requiredDocuments = new HashSet<Record>(sut.Documents);
string? continuationToken = null;

while (requiredDocuments.Any())
while (requiredDocuments.Count > 0)
{
var result = await sut.CrossPartitionPagedQueryAsync(x => x.Where(_ => true), 1, continuationToken);
continuationToken = result.ContinuationToken;
Expand Down

0 comments on commit b4e5206

Please sign in to comment.