mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
Remove moq (#3166)
This commit is contained in:
parent
dd82b8a56f
commit
d4bcaf10ff
4
.github/renovate.json
vendored
4
.github/renovate.json
vendored
@ -43,10 +43,6 @@
|
|||||||
"groupName": "nuget minor",
|
"groupName": "nuget minor",
|
||||||
"matchManagers": ["nuget"],
|
"matchManagers": ["nuget"],
|
||||||
"matchUpdateTypes": ["minor", "patch"]
|
"matchUpdateTypes": ["minor", "patch"]
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchPackageNames": ["Moq"],
|
|
||||||
"allowedVersions": "<=4.18.4"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -940,15 +940,6 @@
|
|||||||
"System.Security.Cryptography.Pkcs": "6.0.0"
|
"System.Security.Cryptography.Pkcs": "6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Moq": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.17.2",
|
|
||||||
"contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"Castle.Core": "4.4.1",
|
|
||||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"NETStandard.Library": {
|
"NETStandard.Library": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "1.6.1",
|
"resolved": "1.6.1",
|
||||||
@ -2675,75 +2666,74 @@
|
|||||||
"commercial.core": {
|
"commercial.core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Core": "2023.7.2"
|
"Core": "[2023.7.2, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"xunit": "2.4.1"
|
"xunit": "[2.4.1, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AWSSDK.SQS": "3.7.2.47",
|
"AWSSDK.SQS": "[3.7.2.47, )",
|
||||||
"AWSSDK.SimpleEmail": "3.7.0.150",
|
"AWSSDK.SimpleEmail": "[3.7.0.150, )",
|
||||||
"AspNetCoreRateLimit": "4.0.2",
|
"AspNetCoreRateLimit": "[4.0.2, )",
|
||||||
"AspNetCoreRateLimit.Redis": "1.0.1",
|
"AspNetCoreRateLimit.Redis": "[1.0.1, )",
|
||||||
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "1.3.2",
|
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "[1.3.2, )",
|
||||||
"Azure.Messaging.ServiceBus": "7.15.0",
|
"Azure.Messaging.ServiceBus": "[7.15.0, )",
|
||||||
"Azure.Storage.Blobs": "12.14.1",
|
"Azure.Storage.Blobs": "[12.14.1, )",
|
||||||
"Azure.Storage.Queues": "12.12.0",
|
"Azure.Storage.Queues": "[12.12.0, )",
|
||||||
"BitPay.Light": "1.0.1907",
|
"BitPay.Light": "[1.0.1907, )",
|
||||||
"Braintree": "5.12.0",
|
"Braintree": "[5.12.0, )",
|
||||||
"DnsClient": "1.7.0",
|
"DnsClient": "[1.7.0, )",
|
||||||
"Fido2.AspNet": "3.0.1",
|
"Fido2.AspNet": "[3.0.1, )",
|
||||||
"Handlebars.Net": "2.1.2",
|
"Handlebars.Net": "[2.1.2, )",
|
||||||
"IdentityServer4": "4.1.2",
|
"IdentityServer4": "[4.1.2, )",
|
||||||
"IdentityServer4.AccessTokenValidation": "3.0.1",
|
"IdentityServer4.AccessTokenValidation": "[3.0.1, )",
|
||||||
"LaunchDarkly.ServerSdk": "7.0.0",
|
"LaunchDarkly.ServerSdk": "[7.0.0, )",
|
||||||
"MailKit": "3.2.0",
|
"MailKit": "[3.2.0, )",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "6.0.4",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "[6.0.4, )",
|
||||||
"Microsoft.Azure.Cosmos.Table": "1.0.8",
|
"Microsoft.Azure.Cosmos.Table": "[1.0.8, )",
|
||||||
"Microsoft.Azure.NotificationHubs": "4.1.0",
|
"Microsoft.Azure.NotificationHubs": "[4.1.0, )",
|
||||||
"Microsoft.Data.SqlClient": "5.0.1",
|
"Microsoft.Data.SqlClient": "[5.0.1, )",
|
||||||
"Microsoft.Extensions.Caching.StackExchangeRedis": "6.0.6",
|
"Microsoft.Extensions.Caching.StackExchangeRedis": "[6.0.6, )",
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Configuration.UserSecrets": "6.0.1",
|
"Microsoft.Extensions.Configuration.UserSecrets": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Identity.Stores": "6.0.4",
|
"Microsoft.Extensions.Identity.Stores": "[6.0.4, )",
|
||||||
"Newtonsoft.Json": "13.0.1",
|
"Newtonsoft.Json": "[13.0.1, )",
|
||||||
"Otp.NET": "1.2.2",
|
"Otp.NET": "[1.2.2, )",
|
||||||
"Quartz": "3.4.0",
|
"Quartz": "[3.4.0, )",
|
||||||
"SendGrid": "9.27.0",
|
"SendGrid": "[9.27.0, )",
|
||||||
"Sentry.Serilog": "3.16.0",
|
"Sentry.Serilog": "[3.16.0, )",
|
||||||
"Serilog.AspNetCore": "5.0.0",
|
"Serilog.AspNetCore": "[5.0.0, )",
|
||||||
"Serilog.Extensions.Logging": "3.1.0",
|
"Serilog.Extensions.Logging": "[3.1.0, )",
|
||||||
"Serilog.Extensions.Logging.File": "2.0.0",
|
"Serilog.Extensions.Logging.File": "[2.0.0, )",
|
||||||
"Serilog.Sinks.AzureCosmosDB": "2.0.0",
|
"Serilog.Sinks.AzureCosmosDB": "[2.0.0, )",
|
||||||
"Serilog.Sinks.SyslogMessages": "2.0.6",
|
"Serilog.Sinks.SyslogMessages": "[2.0.6, )",
|
||||||
"Stripe.net": "40.0.0",
|
"Stripe.net": "[40.0.0, )",
|
||||||
"YubicoDotNetClient": "1.2.0"
|
"YubicoDotNetClient": "[1.2.0, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core.test": {
|
"core.test": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Common": "2023.7.2",
|
"Common": "[2023.7.2, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"Moq": "4.17.2",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"xunit": "[2.4.1, )"
|
||||||
"xunit": "2.4.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1181,15 +1181,6 @@
|
|||||||
"System.Security.Cryptography.Pkcs": "6.0.0"
|
"System.Security.Cryptography.Pkcs": "6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Moq": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "4.17.2",
|
|
||||||
"contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"Castle.Core": "4.4.1",
|
|
||||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"MySqlConnector": {
|
"MySqlConnector": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "2.2.5",
|
"resolved": "2.2.5",
|
||||||
@ -3015,129 +3006,128 @@
|
|||||||
"api": {
|
"api": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AspNetCore.HealthChecks.AzureServiceBus": "6.1.0",
|
"AspNetCore.HealthChecks.AzureServiceBus": "[6.1.0, )",
|
||||||
"AspNetCore.HealthChecks.AzureStorage": "6.1.2",
|
"AspNetCore.HealthChecks.AzureStorage": "[6.1.2, )",
|
||||||
"AspNetCore.HealthChecks.Network": "6.0.4",
|
"AspNetCore.HealthChecks.Network": "[6.0.4, )",
|
||||||
"AspNetCore.HealthChecks.Redis": "6.0.4",
|
"AspNetCore.HealthChecks.Redis": "[6.0.4, )",
|
||||||
"AspNetCore.HealthChecks.SendGrid": "6.0.2",
|
"AspNetCore.HealthChecks.SendGrid": "[6.0.2, )",
|
||||||
"AspNetCore.HealthChecks.SqlServer": "6.0.2",
|
"AspNetCore.HealthChecks.SqlServer": "[6.0.2, )",
|
||||||
"AspNetCore.HealthChecks.Uris": "6.0.3",
|
"AspNetCore.HealthChecks.Uris": "[6.0.3, )",
|
||||||
"Azure.Messaging.EventGrid": "4.10.0",
|
"Azure.Messaging.EventGrid": "[4.10.0, )",
|
||||||
"Commercial.Core": "2023.7.2",
|
"Commercial.Core": "[2023.7.2, )",
|
||||||
"Commercial.Infrastructure.EntityFramework": "2023.7.2",
|
"Commercial.Infrastructure.EntityFramework": "[2023.7.2, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"SharedWeb": "2023.7.2",
|
"SharedWeb": "[2023.7.2, )",
|
||||||
"Swashbuckle.AspNetCore": "6.5.0"
|
"Swashbuckle.AspNetCore": "[6.5.0, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commercial.core": {
|
"commercial.core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Core": "2023.7.2"
|
"Core": "[2023.7.2, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commercial.infrastructure.entityframework": {
|
"commercial.infrastructure.entityframework": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.1",
|
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Infrastructure.EntityFramework": "2023.7.2"
|
"Infrastructure.EntityFramework": "[2023.7.2, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"xunit": "2.4.1"
|
"xunit": "[2.4.1, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AWSSDK.SQS": "3.7.2.47",
|
"AWSSDK.SQS": "[3.7.2.47, )",
|
||||||
"AWSSDK.SimpleEmail": "3.7.0.150",
|
"AWSSDK.SimpleEmail": "[3.7.0.150, )",
|
||||||
"AspNetCoreRateLimit": "4.0.2",
|
"AspNetCoreRateLimit": "[4.0.2, )",
|
||||||
"AspNetCoreRateLimit.Redis": "1.0.1",
|
"AspNetCoreRateLimit.Redis": "[1.0.1, )",
|
||||||
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "1.3.2",
|
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "[1.3.2, )",
|
||||||
"Azure.Messaging.ServiceBus": "7.15.0",
|
"Azure.Messaging.ServiceBus": "[7.15.0, )",
|
||||||
"Azure.Storage.Blobs": "12.14.1",
|
"Azure.Storage.Blobs": "[12.14.1, )",
|
||||||
"Azure.Storage.Queues": "12.12.0",
|
"Azure.Storage.Queues": "[12.12.0, )",
|
||||||
"BitPay.Light": "1.0.1907",
|
"BitPay.Light": "[1.0.1907, )",
|
||||||
"Braintree": "5.12.0",
|
"Braintree": "[5.12.0, )",
|
||||||
"DnsClient": "1.7.0",
|
"DnsClient": "[1.7.0, )",
|
||||||
"Fido2.AspNet": "3.0.1",
|
"Fido2.AspNet": "[3.0.1, )",
|
||||||
"Handlebars.Net": "2.1.2",
|
"Handlebars.Net": "[2.1.2, )",
|
||||||
"IdentityServer4": "4.1.2",
|
"IdentityServer4": "[4.1.2, )",
|
||||||
"IdentityServer4.AccessTokenValidation": "3.0.1",
|
"IdentityServer4.AccessTokenValidation": "[3.0.1, )",
|
||||||
"LaunchDarkly.ServerSdk": "7.0.0",
|
"LaunchDarkly.ServerSdk": "[7.0.0, )",
|
||||||
"MailKit": "3.2.0",
|
"MailKit": "[3.2.0, )",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "6.0.4",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "[6.0.4, )",
|
||||||
"Microsoft.Azure.Cosmos.Table": "1.0.8",
|
"Microsoft.Azure.Cosmos.Table": "[1.0.8, )",
|
||||||
"Microsoft.Azure.NotificationHubs": "4.1.0",
|
"Microsoft.Azure.NotificationHubs": "[4.1.0, )",
|
||||||
"Microsoft.Data.SqlClient": "5.0.1",
|
"Microsoft.Data.SqlClient": "[5.0.1, )",
|
||||||
"Microsoft.Extensions.Caching.StackExchangeRedis": "6.0.6",
|
"Microsoft.Extensions.Caching.StackExchangeRedis": "[6.0.6, )",
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Configuration.UserSecrets": "6.0.1",
|
"Microsoft.Extensions.Configuration.UserSecrets": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Identity.Stores": "6.0.4",
|
"Microsoft.Extensions.Identity.Stores": "[6.0.4, )",
|
||||||
"Newtonsoft.Json": "13.0.1",
|
"Newtonsoft.Json": "[13.0.1, )",
|
||||||
"Otp.NET": "1.2.2",
|
"Otp.NET": "[1.2.2, )",
|
||||||
"Quartz": "3.4.0",
|
"Quartz": "[3.4.0, )",
|
||||||
"SendGrid": "9.27.0",
|
"SendGrid": "[9.27.0, )",
|
||||||
"Sentry.Serilog": "3.16.0",
|
"Sentry.Serilog": "[3.16.0, )",
|
||||||
"Serilog.AspNetCore": "5.0.0",
|
"Serilog.AspNetCore": "[5.0.0, )",
|
||||||
"Serilog.Extensions.Logging": "3.1.0",
|
"Serilog.Extensions.Logging": "[3.1.0, )",
|
||||||
"Serilog.Extensions.Logging.File": "2.0.0",
|
"Serilog.Extensions.Logging.File": "[2.0.0, )",
|
||||||
"Serilog.Sinks.AzureCosmosDB": "2.0.0",
|
"Serilog.Sinks.AzureCosmosDB": "[2.0.0, )",
|
||||||
"Serilog.Sinks.SyslogMessages": "2.0.6",
|
"Serilog.Sinks.SyslogMessages": "[2.0.6, )",
|
||||||
"Stripe.net": "40.0.0",
|
"Stripe.net": "[40.0.0, )",
|
||||||
"YubicoDotNetClient": "1.2.0"
|
"YubicoDotNetClient": "[1.2.0, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core.test": {
|
"core.test": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Common": "2023.7.2",
|
"Common": "[2023.7.2, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"Moq": "4.17.2",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"xunit": "[2.4.1, )"
|
||||||
"xunit": "2.4.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"infrastructure.dapper": {
|
"infrastructure.dapper": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Dapper": "2.0.123"
|
"Dapper": "[2.0.123, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"infrastructure.entityframework": {
|
"infrastructure.entityframework": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.1",
|
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Microsoft.EntityFrameworkCore.Relational": "7.0.5",
|
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
|
||||||
"Microsoft.EntityFrameworkCore.SqlServer": "7.0.5",
|
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
|
||||||
"Microsoft.EntityFrameworkCore.Sqlite": "7.0.5",
|
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
|
||||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "7.0.4",
|
"Npgsql.EntityFrameworkCore.PostgreSQL": "[7.0.4, )",
|
||||||
"Pomelo.EntityFrameworkCore.MySql": "7.0.0",
|
"Pomelo.EntityFrameworkCore.MySql": "[7.0.0, )",
|
||||||
"linq2db.EntityFrameworkCore": "7.5.0"
|
"linq2db.EntityFrameworkCore": "[7.5.0, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sharedweb": {
|
"sharedweb": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Infrastructure.Dapper": "2023.7.2",
|
"Infrastructure.Dapper": "[2023.7.2, )",
|
||||||
"Infrastructure.EntityFramework": "2023.7.2"
|
"Infrastructure.EntityFramework": "[2023.7.2, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ using AutoFixture.Xunit2;
|
|||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Test.Helpers.Factories;
|
using Bit.Core.Test.Helpers.Factories;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Moq;
|
using NSubstitute;
|
||||||
|
|
||||||
namespace Bit.Test.Common.AutoFixture;
|
namespace Bit.Test.Common.AutoFixture;
|
||||||
|
|
||||||
@ -33,17 +33,17 @@ public class GlobalSettingsBuilder : ISpecimenBuilder
|
|||||||
|
|
||||||
if (pi.ParameterType == typeof(IDataProtectionProvider))
|
if (pi.ParameterType == typeof(IDataProtectionProvider))
|
||||||
{
|
{
|
||||||
var dataProtector = new Mock<IDataProtector>();
|
var dataProtector = Substitute.For<IDataProtector>();
|
||||||
dataProtector
|
dataProtector.Unprotect(Arg.Any<byte[]>())
|
||||||
.Setup(d => d.Unprotect(It.IsAny<byte[]>()))
|
.Returns(data =>
|
||||||
.Returns<byte[]>(data => Encoding.UTF8.GetBytes(Constants.DatabaseFieldProtectedPrefix + Encoding.UTF8.GetString(data)));
|
Encoding.UTF8.GetBytes(Constants.DatabaseFieldProtectedPrefix +
|
||||||
|
Encoding.UTF8.GetString((byte[])data[0])));
|
||||||
|
|
||||||
var dataProtectionProvider = new Mock<IDataProtectionProvider>();
|
var dataProtectionProvider = Substitute.For<IDataProtectionProvider>();
|
||||||
dataProtectionProvider
|
dataProtectionProvider.CreateProtector(Constants.DatabaseFieldProtectorPurpose)
|
||||||
.Setup(x => x.CreateProtector(Constants.DatabaseFieldProtectorPurpose))
|
.Returns(dataProtector);
|
||||||
.Returns(dataProtector.Object);
|
|
||||||
|
|
||||||
return dataProtectionProvider.Object;
|
return dataProtectionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new NoSpecimen();
|
return new NoSpecimen();
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="Moq" Version="4.17.2" />
|
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
|
@ -3,7 +3,7 @@ using Bit.Core.Settings;
|
|||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Moq;
|
using NSubstitute;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
@ -37,14 +37,12 @@ public class CustomRedisProcessingStrategyTests
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private readonly Mock<ICounterKeyBuilder> _mockCounterKeyBuilder = new();
|
private readonly ICounterKeyBuilder _mockCounterKeyBuilder = Substitute.For<ICounterKeyBuilder>();
|
||||||
private Mock<IDatabase> _mockDb;
|
private IDatabase _mockDb;
|
||||||
|
|
||||||
public CustomRedisProcessingStrategyTests()
|
public CustomRedisProcessingStrategyTests()
|
||||||
{
|
{
|
||||||
_mockCounterKeyBuilder
|
_mockCounterKeyBuilder.Build(Arg.Any<ClientRequestIdentity>(), Arg.Any<RateLimitRule>())
|
||||||
.Setup(x =>
|
|
||||||
x.Build(It.IsAny<ClientRequestIdentity>(), It.IsAny<RateLimitRule>()))
|
|
||||||
.Returns(_sampleClientId.ClientId);
|
.Returns(_sampleClientId.ClientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,12 +53,12 @@ public class CustomRedisProcessingStrategyTests
|
|||||||
var strategy = BuildProcessingStrategy();
|
var strategy = BuildProcessingStrategy();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(1, result.Count);
|
Assert.Equal(1, result.Count);
|
||||||
VerifyRedisCalls(Times.Once());
|
VerifyRedisCalls(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@ -70,60 +68,63 @@ public class CustomRedisProcessingStrategyTests
|
|||||||
var strategy = BuildProcessingStrategy(false);
|
var strategy = BuildProcessingStrategy(false);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(0, result.Count);
|
Assert.Equal(0, result.Count);
|
||||||
VerifyRedisCalls(Times.Never());
|
VerifyRedisNotCalled();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task SkipRateLimit_When_TimeoutThresholdExceeded()
|
public async Task SkipRateLimit_When_TimeoutThresholdExceeded()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockCache = new Mock<IMemoryCache>();
|
var mockCache = Substitute.For<IMemoryCache>();
|
||||||
object existingCount = new CustomRedisProcessingStrategy.TimeoutCounter
|
object existingCount = new CustomRedisProcessingStrategy.TimeoutCounter
|
||||||
{
|
{
|
||||||
Count = _sampleSettings.DistributedIpRateLimiting.MaxRedisTimeoutsThreshold + 1
|
Count = _sampleSettings.DistributedIpRateLimiting.MaxRedisTimeoutsThreshold + 1
|
||||||
};
|
};
|
||||||
mockCache.Setup(x => x.TryGetValue(It.IsAny<object>(), out existingCount)).Returns(true);
|
mockCache.TryGetValue(Arg.Any<object>(), out existingCount).ReturnsForAnyArgs(x =>
|
||||||
|
{
|
||||||
|
x[1] = existingCount;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
var strategy = BuildProcessingStrategy(mockCache: mockCache.Object);
|
var strategy = BuildProcessingStrategy(mockCache: mockCache);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(0, result.Count);
|
Assert.Equal(0, result.Count);
|
||||||
VerifyRedisCalls(Times.Never());
|
VerifyRedisNotCalled();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task SkipRateLimit_When_RedisTimeoutException()
|
public async Task SkipRateLimit_When_RedisTimeoutException()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var mockCache = new Mock<IMemoryCache>();
|
var mockCache = Substitute.For<IMemoryCache>();
|
||||||
var mockCacheEntry = new Mock<ICacheEntry>();
|
var mockCacheEntry = Substitute.For<ICacheEntry>();
|
||||||
mockCacheEntry.SetupAllProperties();
|
mockCache.CreateEntry(Arg.Any<object>()).Returns(mockCacheEntry);
|
||||||
mockCache.Setup(x => x.CreateEntry(It.IsAny<object>())).Returns(mockCacheEntry.Object);
|
|
||||||
|
|
||||||
var strategy = BuildProcessingStrategy(mockCache: mockCache.Object, throwRedisTimeout: true);
|
var strategy = BuildProcessingStrategy(mockCache: mockCache, throwRedisTimeout: true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
var result = await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
var timeoutCounter = ((CustomRedisProcessingStrategy.TimeoutCounter)mockCacheEntry.Object.Value);
|
var timeoutCounter = ((CustomRedisProcessingStrategy.TimeoutCounter)mockCacheEntry.Value);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(0, result.Count); // Skip rate limiting
|
Assert.Equal(0, result.Count); // Skip rate limiting
|
||||||
VerifyRedisCalls(Times.Once());
|
VerifyRedisCalls(1);
|
||||||
|
|
||||||
Assert.Equal(1, timeoutCounter.Count); // Timeout count increased/cached
|
Assert.Equal(1, timeoutCounter.Count); // Timeout count increased/cached
|
||||||
Assert.NotNull(mockCacheEntry.Object.AbsoluteExpiration);
|
Assert.NotNull(mockCacheEntry.AbsoluteExpiration);
|
||||||
mockCache.Verify(x => x.CreateEntry(It.IsAny<object>()));
|
mockCache.Received().CreateEntry(Arg.Any<object>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@ -136,26 +137,33 @@ public class CustomRedisProcessingStrategyTests
|
|||||||
// Act
|
// Act
|
||||||
|
|
||||||
// Redis Timeout 1
|
// Redis Timeout 1
|
||||||
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Redis Timeout 2
|
// Redis Timeout 2
|
||||||
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Skip Redis
|
// Skip Redis
|
||||||
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder.Object, _sampleOptions,
|
await strategy.ProcessRequestAsync(_sampleClientId, _sampleRule, _mockCounterKeyBuilder, _sampleOptions,
|
||||||
CancellationToken.None);
|
CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
VerifyRedisCalls(Times.Exactly(_sampleSettings.DistributedIpRateLimiting.MaxRedisTimeoutsThreshold));
|
VerifyRedisCalls(_sampleSettings.DistributedIpRateLimiting.MaxRedisTimeoutsThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VerifyRedisCalls(Times times)
|
private void VerifyRedisCalls(int times)
|
||||||
{
|
{
|
||||||
_mockDb.Verify(x =>
|
_mockDb
|
||||||
x.ScriptEvaluateAsync(It.IsAny<LuaScript>(), It.IsAny<object>(), It.IsAny<CommandFlags>()),
|
.Received(times)
|
||||||
times);
|
.ScriptEvaluateAsync(Arg.Any<LuaScript>(), Arg.Any<object>(), Arg.Any<CommandFlags>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VerifyRedisNotCalled()
|
||||||
|
{
|
||||||
|
_mockDb
|
||||||
|
.DidNotReceive()
|
||||||
|
.ScriptEvaluateAsync(Arg.Any<LuaScript>(), Arg.Any<object>(), Arg.Any<CommandFlags>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomRedisProcessingStrategy BuildProcessingStrategy(
|
private CustomRedisProcessingStrategy BuildProcessingStrategy(
|
||||||
@ -163,36 +171,33 @@ public class CustomRedisProcessingStrategyTests
|
|||||||
bool throwRedisTimeout = false,
|
bool throwRedisTimeout = false,
|
||||||
IMemoryCache mockCache = null)
|
IMemoryCache mockCache = null)
|
||||||
{
|
{
|
||||||
var mockRedisConnection = new Mock<IConnectionMultiplexer>();
|
var mockRedisConnection = Substitute.For<IConnectionMultiplexer>();
|
||||||
|
|
||||||
mockRedisConnection.Setup(x => x.IsConnected).Returns(isRedisConnected);
|
mockRedisConnection.IsConnected.Returns(isRedisConnected);
|
||||||
|
|
||||||
_mockDb = new Mock<IDatabase>();
|
_mockDb = Substitute.For<IDatabase>();
|
||||||
|
|
||||||
var mockScriptEvaluate = _mockDb
|
var mockScriptEvaluate = _mockDb
|
||||||
.Setup(x =>
|
.ScriptEvaluateAsync(Arg.Any<LuaScript>(), Arg.Any<object>(), Arg.Any<CommandFlags>());
|
||||||
x.ScriptEvaluateAsync(It.IsAny<LuaScript>(), It.IsAny<object>(), It.IsAny<CommandFlags>()));
|
|
||||||
|
|
||||||
if (throwRedisTimeout)
|
if (throwRedisTimeout)
|
||||||
{
|
{
|
||||||
mockScriptEvaluate.ThrowsAsync(new RedisTimeoutException("Timeout", CommandStatus.WaitingToBeSent));
|
mockScriptEvaluate.Returns<RedisResult>(x => throw new RedisTimeoutException("Timeout", CommandStatus.WaitingToBeSent));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mockScriptEvaluate.ReturnsAsync(RedisResult.Create(1));
|
mockScriptEvaluate.Returns(RedisResult.Create(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
mockRedisConnection
|
mockRedisConnection.GetDatabase(Arg.Any<int>(), Arg.Any<object>())
|
||||||
.Setup(x =>
|
.Returns(_mockDb);
|
||||||
x.GetDatabase(It.IsAny<int>(), It.IsAny<object>()))
|
|
||||||
.Returns(_mockDb.Object);
|
|
||||||
|
|
||||||
var mockLogger = new Mock<ILogger<CustomRedisProcessingStrategy>>();
|
var mockLogger = Substitute.For<ILogger<CustomRedisProcessingStrategy>>();
|
||||||
var mockConfig = new Mock<IRateLimitConfiguration>();
|
var mockConfig = Substitute.For<IRateLimitConfiguration>();
|
||||||
|
|
||||||
mockCache ??= new Mock<IMemoryCache>().Object;
|
mockCache ??= Substitute.For<IMemoryCache>();
|
||||||
|
|
||||||
return new CustomRedisProcessingStrategy(mockRedisConnection.Object, mockConfig.Object,
|
return new CustomRedisProcessingStrategy(mockRedisConnection, mockConfig,
|
||||||
mockLogger.Object, mockCache, _sampleSettings);
|
mockLogger, mockCache, _sampleSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,16 +48,6 @@
|
|||||||
"Microsoft.TestPlatform.TestHost": "17.1.0"
|
"Microsoft.TestPlatform.TestHost": "17.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Moq": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[4.17.2, )",
|
|
||||||
"resolved": "4.17.2",
|
|
||||||
"contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"Castle.Core": "4.4.1",
|
|
||||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"NSubstitute": {
|
"NSubstitute": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[4.3.0, )",
|
"requested": "[4.3.0, )",
|
||||||
@ -2680,55 +2670,55 @@
|
|||||||
"common": {
|
"common": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"xunit": "2.4.1"
|
"xunit": "[2.4.1, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AWSSDK.SQS": "3.7.2.47",
|
"AWSSDK.SQS": "[3.7.2.47, )",
|
||||||
"AWSSDK.SimpleEmail": "3.7.0.150",
|
"AWSSDK.SimpleEmail": "[3.7.0.150, )",
|
||||||
"AspNetCoreRateLimit": "4.0.2",
|
"AspNetCoreRateLimit": "[4.0.2, )",
|
||||||
"AspNetCoreRateLimit.Redis": "1.0.1",
|
"AspNetCoreRateLimit.Redis": "[1.0.1, )",
|
||||||
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "1.3.2",
|
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "[1.3.2, )",
|
||||||
"Azure.Messaging.ServiceBus": "7.15.0",
|
"Azure.Messaging.ServiceBus": "[7.15.0, )",
|
||||||
"Azure.Storage.Blobs": "12.14.1",
|
"Azure.Storage.Blobs": "[12.14.1, )",
|
||||||
"Azure.Storage.Queues": "12.12.0",
|
"Azure.Storage.Queues": "[12.12.0, )",
|
||||||
"BitPay.Light": "1.0.1907",
|
"BitPay.Light": "[1.0.1907, )",
|
||||||
"Braintree": "5.12.0",
|
"Braintree": "[5.12.0, )",
|
||||||
"DnsClient": "1.7.0",
|
"DnsClient": "[1.7.0, )",
|
||||||
"Fido2.AspNet": "3.0.1",
|
"Fido2.AspNet": "[3.0.1, )",
|
||||||
"Handlebars.Net": "2.1.2",
|
"Handlebars.Net": "[2.1.2, )",
|
||||||
"IdentityServer4": "4.1.2",
|
"IdentityServer4": "[4.1.2, )",
|
||||||
"IdentityServer4.AccessTokenValidation": "3.0.1",
|
"IdentityServer4.AccessTokenValidation": "[3.0.1, )",
|
||||||
"LaunchDarkly.ServerSdk": "7.0.0",
|
"LaunchDarkly.ServerSdk": "[7.0.0, )",
|
||||||
"MailKit": "3.2.0",
|
"MailKit": "[3.2.0, )",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "6.0.4",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "[6.0.4, )",
|
||||||
"Microsoft.Azure.Cosmos.Table": "1.0.8",
|
"Microsoft.Azure.Cosmos.Table": "[1.0.8, )",
|
||||||
"Microsoft.Azure.NotificationHubs": "4.1.0",
|
"Microsoft.Azure.NotificationHubs": "[4.1.0, )",
|
||||||
"Microsoft.Data.SqlClient": "5.0.1",
|
"Microsoft.Data.SqlClient": "[5.0.1, )",
|
||||||
"Microsoft.Extensions.Caching.StackExchangeRedis": "6.0.6",
|
"Microsoft.Extensions.Caching.StackExchangeRedis": "[6.0.6, )",
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Configuration.UserSecrets": "6.0.1",
|
"Microsoft.Extensions.Configuration.UserSecrets": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Identity.Stores": "6.0.4",
|
"Microsoft.Extensions.Identity.Stores": "[6.0.4, )",
|
||||||
"Newtonsoft.Json": "13.0.1",
|
"Newtonsoft.Json": "[13.0.1, )",
|
||||||
"Otp.NET": "1.2.2",
|
"Otp.NET": "[1.2.2, )",
|
||||||
"Quartz": "3.4.0",
|
"Quartz": "[3.4.0, )",
|
||||||
"SendGrid": "9.27.0",
|
"SendGrid": "[9.27.0, )",
|
||||||
"Sentry.Serilog": "3.16.0",
|
"Sentry.Serilog": "[3.16.0, )",
|
||||||
"Serilog.AspNetCore": "5.0.0",
|
"Serilog.AspNetCore": "[5.0.0, )",
|
||||||
"Serilog.Extensions.Logging": "3.1.0",
|
"Serilog.Extensions.Logging": "[3.1.0, )",
|
||||||
"Serilog.Extensions.Logging.File": "2.0.0",
|
"Serilog.Extensions.Logging.File": "[2.0.0, )",
|
||||||
"Serilog.Sinks.AzureCosmosDB": "2.0.0",
|
"Serilog.Sinks.AzureCosmosDB": "[2.0.0, )",
|
||||||
"Serilog.Sinks.SyslogMessages": "2.0.6",
|
"Serilog.Sinks.SyslogMessages": "[2.0.6, )",
|
||||||
"Stripe.net": "40.0.0",
|
"Stripe.net": "[40.0.0, )",
|
||||||
"YubicoDotNetClient": "1.2.0"
|
"YubicoDotNetClient": "[1.2.0, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using Bit.Infrastructure.EntityFramework.Repositories;
|
|||||||
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
using Bit.Infrastructure.EntityFramework.Vault.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using NSubstitute;
|
||||||
|
|
||||||
namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
||||||
|
|
||||||
@ -25,20 +25,16 @@ internal class ServiceScopeFactoryBuilder : ISpecimenBuilder
|
|||||||
public object Create(object request, ISpecimenContext context)
|
public object Create(object request, ISpecimenContext context)
|
||||||
{
|
{
|
||||||
var fixture = new Fixture();
|
var fixture = new Fixture();
|
||||||
var serviceProvider = new Mock<IServiceProvider>();
|
var serviceProvider = Substitute.For<IServiceProvider>();
|
||||||
var dbContext = new DatabaseContext(_options);
|
var dbContext = new DatabaseContext(_options);
|
||||||
serviceProvider
|
serviceProvider.GetService(typeof(DatabaseContext)).Returns(dbContext);
|
||||||
.Setup(x => x.GetService(typeof(DatabaseContext)))
|
|
||||||
.Returns(dbContext);
|
|
||||||
|
|
||||||
var serviceScope = new Mock<IServiceScope>();
|
var serviceScope = Substitute.For<IServiceScope>();
|
||||||
serviceScope.Setup(x => x.ServiceProvider).Returns(serviceProvider.Object);
|
serviceScope.ServiceProvider.Returns(serviceProvider);
|
||||||
|
|
||||||
var serviceScopeFactory = new Mock<IServiceScopeFactory>();
|
var serviceScopeFactory = Substitute.For<IServiceScopeFactory>();
|
||||||
serviceScopeFactory
|
serviceScopeFactory.CreateScope().Returns(serviceScope);
|
||||||
.Setup(x => x.CreateScope())
|
return serviceScopeFactory;
|
||||||
.Returns(serviceScope.Object);
|
|
||||||
return serviceScopeFactory.Object;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ using Bit.Infrastructure.EntityFramework.Repositories;
|
|||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Moq;
|
using NSubstitute;
|
||||||
|
|
||||||
namespace Bit.Infrastructure.EFIntegration.Test.Helpers;
|
namespace Bit.Infrastructure.EFIntegration.Test.Helpers;
|
||||||
|
|
||||||
@ -18,17 +18,17 @@ public static class DatabaseOptionsFactory
|
|||||||
var services = new ServiceCollection()
|
var services = new ServiceCollection()
|
||||||
.AddSingleton(sp =>
|
.AddSingleton(sp =>
|
||||||
{
|
{
|
||||||
var dataProtector = new Mock<IDataProtector>();
|
var dataProtector = Substitute.For<IDataProtector>();
|
||||||
dataProtector
|
dataProtector.Unprotect(Arg.Any<byte[]>())
|
||||||
.Setup(d => d.Unprotect(It.IsAny<byte[]>()))
|
.Returns<byte[]>(data =>
|
||||||
.Returns<byte[]>(data => Encoding.UTF8.GetBytes(Constants.DatabaseFieldProtectedPrefix + Encoding.UTF8.GetString(data)));
|
Encoding.UTF8.GetBytes(Constants.DatabaseFieldProtectedPrefix +
|
||||||
|
Encoding.UTF8.GetString((byte[])data[0])));
|
||||||
|
|
||||||
var dataProtectionProvider = new Mock<IDataProtectionProvider>();
|
var dataProtectionProvider = Substitute.For<IDataProtectionProvider>();
|
||||||
dataProtectionProvider
|
dataProtectionProvider.CreateProtector(Constants.DatabaseFieldProtectorPurpose)
|
||||||
.Setup(x => x.CreateProtector(Constants.DatabaseFieldProtectorPurpose))
|
.Returns(dataProtector);
|
||||||
.Returns(dataProtector.Object);
|
|
||||||
|
|
||||||
return dataProtectionProvider.Object;
|
return dataProtectionProvider;
|
||||||
})
|
})
|
||||||
.BuildServiceProvider();
|
.BuildServiceProvider();
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
|
||||||
<PackageReference Include="Moq" Version="4.17.2" />
|
|
||||||
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
<PackageReference Include="NSubstitute" Version="$(NSubstituteVersion)" />
|
||||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVisualStudioVersion)">
|
||||||
|
@ -38,16 +38,6 @@
|
|||||||
"Microsoft.TestPlatform.TestHost": "17.1.0"
|
"Microsoft.TestPlatform.TestHost": "17.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Moq": {
|
|
||||||
"type": "Direct",
|
|
||||||
"requested": "[4.17.2, )",
|
|
||||||
"resolved": "4.17.2",
|
|
||||||
"contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"Castle.Core": "4.4.1",
|
|
||||||
"System.Threading.Tasks.Extensions": "4.5.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"NSubstitute": {
|
"NSubstitute": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[4.3.0, )",
|
"requested": "[4.3.0, )",
|
||||||
@ -2843,89 +2833,88 @@
|
|||||||
"common": {
|
"common": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"xunit": "2.4.1"
|
"xunit": "[2.4.1, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AWSSDK.SQS": "3.7.2.47",
|
"AWSSDK.SQS": "[3.7.2.47, )",
|
||||||
"AWSSDK.SimpleEmail": "3.7.0.150",
|
"AWSSDK.SimpleEmail": "[3.7.0.150, )",
|
||||||
"AspNetCoreRateLimit": "4.0.2",
|
"AspNetCoreRateLimit": "[4.0.2, )",
|
||||||
"AspNetCoreRateLimit.Redis": "1.0.1",
|
"AspNetCoreRateLimit.Redis": "[1.0.1, )",
|
||||||
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "1.3.2",
|
"Azure.Extensions.AspNetCore.DataProtection.Blobs": "[1.3.2, )",
|
||||||
"Azure.Messaging.ServiceBus": "7.15.0",
|
"Azure.Messaging.ServiceBus": "[7.15.0, )",
|
||||||
"Azure.Storage.Blobs": "12.14.1",
|
"Azure.Storage.Blobs": "[12.14.1, )",
|
||||||
"Azure.Storage.Queues": "12.12.0",
|
"Azure.Storage.Queues": "[12.12.0, )",
|
||||||
"BitPay.Light": "1.0.1907",
|
"BitPay.Light": "[1.0.1907, )",
|
||||||
"Braintree": "5.12.0",
|
"Braintree": "[5.12.0, )",
|
||||||
"DnsClient": "1.7.0",
|
"DnsClient": "[1.7.0, )",
|
||||||
"Fido2.AspNet": "3.0.1",
|
"Fido2.AspNet": "[3.0.1, )",
|
||||||
"Handlebars.Net": "2.1.2",
|
"Handlebars.Net": "[2.1.2, )",
|
||||||
"IdentityServer4": "4.1.2",
|
"IdentityServer4": "[4.1.2, )",
|
||||||
"IdentityServer4.AccessTokenValidation": "3.0.1",
|
"IdentityServer4.AccessTokenValidation": "[3.0.1, )",
|
||||||
"LaunchDarkly.ServerSdk": "7.0.0",
|
"LaunchDarkly.ServerSdk": "[7.0.0, )",
|
||||||
"MailKit": "3.2.0",
|
"MailKit": "[3.2.0, )",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "6.0.4",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "[6.0.4, )",
|
||||||
"Microsoft.Azure.Cosmos.Table": "1.0.8",
|
"Microsoft.Azure.Cosmos.Table": "[1.0.8, )",
|
||||||
"Microsoft.Azure.NotificationHubs": "4.1.0",
|
"Microsoft.Azure.NotificationHubs": "[4.1.0, )",
|
||||||
"Microsoft.Data.SqlClient": "5.0.1",
|
"Microsoft.Data.SqlClient": "[5.0.1, )",
|
||||||
"Microsoft.Extensions.Caching.StackExchangeRedis": "6.0.6",
|
"Microsoft.Extensions.Caching.StackExchangeRedis": "[6.0.6, )",
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "6.0.1",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Configuration.UserSecrets": "6.0.1",
|
"Microsoft.Extensions.Configuration.UserSecrets": "[6.0.1, )",
|
||||||
"Microsoft.Extensions.Identity.Stores": "6.0.4",
|
"Microsoft.Extensions.Identity.Stores": "[6.0.4, )",
|
||||||
"Newtonsoft.Json": "13.0.1",
|
"Newtonsoft.Json": "[13.0.1, )",
|
||||||
"Otp.NET": "1.2.2",
|
"Otp.NET": "[1.2.2, )",
|
||||||
"Quartz": "3.4.0",
|
"Quartz": "[3.4.0, )",
|
||||||
"SendGrid": "9.27.0",
|
"SendGrid": "[9.27.0, )",
|
||||||
"Sentry.Serilog": "3.16.0",
|
"Sentry.Serilog": "[3.16.0, )",
|
||||||
"Serilog.AspNetCore": "5.0.0",
|
"Serilog.AspNetCore": "[5.0.0, )",
|
||||||
"Serilog.Extensions.Logging": "3.1.0",
|
"Serilog.Extensions.Logging": "[3.1.0, )",
|
||||||
"Serilog.Extensions.Logging.File": "2.0.0",
|
"Serilog.Extensions.Logging.File": "[2.0.0, )",
|
||||||
"Serilog.Sinks.AzureCosmosDB": "2.0.0",
|
"Serilog.Sinks.AzureCosmosDB": "[2.0.0, )",
|
||||||
"Serilog.Sinks.SyslogMessages": "2.0.6",
|
"Serilog.Sinks.SyslogMessages": "[2.0.6, )",
|
||||||
"Stripe.net": "40.0.0",
|
"Stripe.net": "[40.0.0, )",
|
||||||
"YubicoDotNetClient": "1.2.0"
|
"YubicoDotNetClient": "[1.2.0, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core.test": {
|
"core.test": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoFixture.AutoNSubstitute": "4.17.0",
|
"AutoFixture.AutoNSubstitute": "[4.17.0, )",
|
||||||
"AutoFixture.Xunit2": "4.17.0",
|
"AutoFixture.Xunit2": "[4.17.0, )",
|
||||||
"Common": "2023.7.2",
|
"Common": "[2023.7.2, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Kralizek.AutoFixture.Extensions.MockHttp": "1.2.0",
|
"Kralizek.AutoFixture.Extensions.MockHttp": "[1.2.0, )",
|
||||||
"Microsoft.NET.Test.Sdk": "17.1.0",
|
"Microsoft.NET.Test.Sdk": "[17.1.0, )",
|
||||||
"Moq": "4.17.2",
|
"NSubstitute": "[4.3.0, )",
|
||||||
"NSubstitute": "4.3.0",
|
"xunit": "[2.4.1, )"
|
||||||
"xunit": "2.4.1"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"infrastructure.dapper": {
|
"infrastructure.dapper": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Dapper": "2.0.123"
|
"Dapper": "[2.0.123, )"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"infrastructure.entityframework": {
|
"infrastructure.entityframework": {
|
||||||
"type": "Project",
|
"type": "Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "12.0.1",
|
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
|
||||||
"Core": "2023.7.2",
|
"Core": "[2023.7.2, )",
|
||||||
"Microsoft.EntityFrameworkCore.Relational": "7.0.5",
|
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
|
||||||
"Microsoft.EntityFrameworkCore.SqlServer": "7.0.5",
|
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
|
||||||
"Microsoft.EntityFrameworkCore.Sqlite": "7.0.5",
|
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
|
||||||
"Npgsql.EntityFrameworkCore.PostgreSQL": "7.0.4",
|
"Npgsql.EntityFrameworkCore.PostgreSQL": "[7.0.4, )",
|
||||||
"Pomelo.EntityFrameworkCore.MySql": "7.0.0",
|
"Pomelo.EntityFrameworkCore.MySql": "[7.0.0, )",
|
||||||
"linq2db.EntityFrameworkCore": "7.5.0"
|
"linq2db.EntityFrameworkCore": "[7.5.0, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user