1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@ -8,19 +8,20 @@ using Bit.Test.Common.Helpers;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections;
[SutProviderCustomize]
public class CreateOrganizationConnectionCommandTests
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections
{
[Theory]
[BitAutoData]
public async Task CreateAsync_CallsCreate(OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<CreateOrganizationConnectionCommand> sutProvider)
[SutProviderCustomize]
public class CreateOrganizationConnectionCommandTests
{
await sutProvider.Sut.CreateAsync(data);
[Theory]
[BitAutoData]
public async Task CreateAsync_CallsCreate(OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<CreateOrganizationConnectionCommand> sutProvider)
{
await sutProvider.Sut.CreateAsync(data);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.CreateAsync(Arg.Is(AssertHelper.AssertPropertyEqual(data.ToEntity())));
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.CreateAsync(Arg.Is(AssertHelper.AssertPropertyEqual(data.ToEntity())));
}
}
}

View File

@ -6,19 +6,20 @@ using Bit.Test.Common.AutoFixture.Attributes;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections;
[SutProviderCustomize]
public class DeleteOrganizationConnectionCommandTests
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections
{
[Theory]
[BitAutoData]
public async Task DeleteAsync_CallsDelete(OrganizationConnection connection,
SutProvider<DeleteOrganizationConnectionCommand> sutProvider)
[SutProviderCustomize]
public class DeleteOrganizationConnectionCommandTests
{
await sutProvider.Sut.DeleteAsync(connection);
[Theory]
[BitAutoData]
public async Task DeleteAsync_CallsDelete(OrganizationConnection connection,
SutProvider<DeleteOrganizationConnectionCommand> sutProvider)
{
await sutProvider.Sut.DeleteAsync(connection);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.DeleteAsync(connection);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.DeleteAsync(connection);
}
}
}

View File

@ -10,49 +10,50 @@ using Bit.Test.Common.Helpers;
using NSubstitute;
using Xunit;
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections;
[SutProviderCustomize]
public class UpdateOrganizationConnectionCommandTests
namespace Bit.Core.Test.OrganizationFeatures.OrganizationConnections
{
[Theory]
[BitAutoData]
public async Task UpdateAsync_NoId_Fails(OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
[SutProviderCustomize]
public class UpdateOrganizationConnectionCommandTests
{
data.Id = null;
[Theory]
[BitAutoData]
public async Task UpdateAsync_NoId_Fails(OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
{
data.Id = null;
var exception = await Assert.ThrowsAsync<Exception>(() => sutProvider.Sut.UpdateAsync(data));
var exception = await Assert.ThrowsAsync<Exception>(() => sutProvider.Sut.UpdateAsync(data));
Assert.Contains("Cannot update connection, Connection does not exist.", exception.Message);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().DidNotReceiveWithAnyArgs()
.UpsertAsync(default);
}
Assert.Contains("Cannot update connection, Connection does not exist.", exception.Message);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().DidNotReceiveWithAnyArgs()
.UpsertAsync(default);
}
[Theory]
[BitAutoData]
public async Task UpdateAsync_ConnectionDoesNotExist_ThrowsNotFound(
OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
{
var exception = await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.UpdateAsync(data));
[Theory]
[BitAutoData]
public async Task UpdateAsync_ConnectionDoesNotExist_ThrowsNotFound(
OrganizationConnectionData<BillingSyncConfig> data,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
{
var exception = await Assert.ThrowsAsync<NotFoundException>(() => sutProvider.Sut.UpdateAsync(data));
await sutProvider.GetDependency<IOrganizationConnectionRepository>().DidNotReceiveWithAnyArgs()
.UpsertAsync(default);
}
await sutProvider.GetDependency<IOrganizationConnectionRepository>().DidNotReceiveWithAnyArgs()
.UpsertAsync(default);
}
[Theory]
[BitAutoData]
public async Task UpdateAsync_CallsUpsert(OrganizationConnectionData<BillingSyncConfig> data,
OrganizationConnection existing,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
{
data.Id = existing.Id;
[Theory]
[BitAutoData]
public async Task UpdateAsync_CallsUpsert(OrganizationConnectionData<BillingSyncConfig> data,
OrganizationConnection existing,
SutProvider<UpdateOrganizationConnectionCommand> sutProvider)
{
data.Id = existing.Id;
sutProvider.GetDependency<IOrganizationConnectionRepository>().GetByIdAsync(data.Id.Value).Returns(existing);
await sutProvider.Sut.UpdateAsync(data);
sutProvider.GetDependency<IOrganizationConnectionRepository>().GetByIdAsync(data.Id.Value).Returns(existing);
await sutProvider.Sut.UpdateAsync(data);
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.UpsertAsync(Arg.Is(AssertHelper.AssertPropertyEqual(data.ToEntity())));
await sutProvider.GetDependency<IOrganizationConnectionRepository>().Received(1)
.UpsertAsync(Arg.Is(AssertHelper.AssertPropertyEqual(data.ToEntity())));
}
}
}