1
0
mirror of https://github.com/bitwarden/server synced 2025-12-29 22:54:00 +00:00

[PS-40] Upgrade to .NET 6 (#2056)

* Bump to .NET 6

* Update Docker images

* Update docs

* Update workflow for linter

* Add all common versions to props file

* Update tools manifest

* Update csproj files

* Update packages.lock.json files

* Switch to setup-dotnet

* Remove msbuild

* Fix deps breaking changes

* Manually install msbuild

* Use msbuild for build

* Fix verbosity switch

* Remove unused exceptions

* Address linter feedback

* Make Obsolete warnings suggestions for now.

* Force Evaluate

* Format on tests

* Run formatting again.

* Use windows 2022

* force evaluate

* Fix restore

* Fix linter

* Skip test

* Update Directory.Build.props

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

* Address PR feedback

* Add IntegationTest for Rate limiter

* Fix test

* Reenable test

* Reorder test

* Skip test again

* Add tracking link

* Update .github/workflows/build.yml

Co-authored-by: Micaiah Martin <77340197+mimartin12@users.noreply.github.com>

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
Co-authored-by: Micaiah Martin <77340197+mimartin12@users.noreply.github.com>
This commit is contained in:
Justin Baur
2022-06-24 10:39:34 -04:00
committed by GitHub
parent b8d41b47f1
commit daeaa42851
95 changed files with 15042 additions and 32574 deletions

View File

@@ -1,6 +1,7 @@
using System;
using Bit.Core.Services;
using Bit.Core.Settings;
using Microsoft.Extensions.Logging;
using NSubstitute;
using Xunit;
@@ -11,12 +12,14 @@ namespace Bit.Core.Test.Services
private readonly AzureAttachmentStorageService _sut;
private readonly GlobalSettings _globalSettings;
private readonly ILogger<AzureAttachmentStorageService> _logger;
public AzureAttachmentStorageServiceTests()
{
_globalSettings = new GlobalSettings();
_logger = Substitute.For<ILogger<AzureAttachmentStorageService>>();
_sut = new AzureAttachmentStorageService(_globalSettings);
_sut = new AzureAttachmentStorageService(_globalSettings, _logger);
}
// Remove this test when we add actual tests. It only proves that

View File

@@ -35,8 +35,7 @@ namespace Bit.Core.Test.Services
[Theory, CollectionAutoData]
public async Task SaveAsync_DefaultIdWithGroups_CreateCollectionWithGroupsInRepository(Collection collection,
IEnumerable<SelectionReadOnly> groups, Organization organization, OrganizationUser organizationUser,
SutProvider<CollectionService> sutProvider)
IEnumerable<SelectionReadOnly> groups, Organization organization, SutProvider<CollectionService> sutProvider)
{
collection.Id = default;
organization.UseGroups = true;
@@ -70,7 +69,7 @@ namespace Bit.Core.Test.Services
[Theory, CollectionAutoData]
public async Task SaveAsync_OrganizationNotUseGroup_CreateCollectionWithoutGroupsInRepository(Collection collection, IEnumerable<SelectionReadOnly> groups,
Organization organization, OrganizationUser organizationUser, SutProvider<CollectionService> sutProvider)
Organization organization, SutProvider<CollectionService> sutProvider)
{
collection.Id = default;
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(organization.Id).Returns(organization);
@@ -120,7 +119,7 @@ namespace Bit.Core.Test.Services
}
[Theory, CollectionAutoData]
public async Task SaveAsync_ExceedsOrganizationMaxCollections_ThrowsBadRequest(Collection collection, Collection collection1, Collection collection2, Organization organization, SutProvider<CollectionService> sutProvider)
public async Task SaveAsync_ExceedsOrganizationMaxCollections_ThrowsBadRequest(Collection collection, Organization organization, SutProvider<CollectionService> sutProvider)
{
collection.Id = default;
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(organization.Id).Returns(organization);

View File

@@ -68,7 +68,7 @@ namespace Bit.Core.Test.Services
}
[Theory, CustomAutoData(typeof(SutProviderCustomization))]
public async Task SaveAsync_NonExistingOrganizationId_ThrowsBadRequest(Group group, Organization organization, SutProvider<GroupService> sutProvider)
public async Task SaveAsync_NonExistingOrganizationId_ThrowsBadRequest(Group group, SutProvider<GroupService> sutProvider)
{
var exception = await Assert.ThrowsAsync<BadRequestException>(
() => sutProvider.Sut.SaveAsync(group));

View File

@@ -869,7 +869,7 @@ namespace Bit.Core.Test.Services
[InlinePaidOrganizationAutoData(0, null, 100, true, "")]
[InlinePaidOrganizationAutoData(1, 100, null, true, "")]
[InlinePaidOrganizationAutoData(1, 100, 100, false, "Cannot invite new users. Seat limit has been reached")]
public async Task CanScale(int seatsToAdd, int? currentSeats, int? maxAutoscaleSeats,
public void CanScale(int seatsToAdd, int? currentSeats, int? maxAutoscaleSeats,
bool expectedResult, string expectedFailureMessage, Organization organization,
SutProvider<OrganizationService> sutProvider)
{
@@ -891,7 +891,7 @@ namespace Bit.Core.Test.Services
}
[Theory, PaidOrganizationAutoData]
public async Task CanScale_FailsOnSelfHosted(Organization organization,
public void CanScale_FailsOnSelfHosted(Organization organization,
SutProvider<OrganizationService> sutProvider)
{
sutProvider.GetDependency<IGlobalSettings>().SelfHosted.Returns(true);

View File

@@ -495,8 +495,6 @@ namespace Bit.Core.Test.Services
send.UserId = user.Id;
send.Type = SendType.File;
var testUrl = "https://test.com/";
sutProvider.GetDependency<IUserRepository>()
.GetByIdAsync(user.Id)
.Returns(user);