1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00
bitwarden-server/test/Core.Test/AutoFixture/CollectionAccessSelectionFixtures.cs
Vincent Salucci 02b3453cd5
[AC-2646] Remove FC MVP dead code from Core (#4281)
* chore: remove fc refs in CreateGroup and UpdateGroup commands, refs AC-2646

* chore: remove fc refs and update interface to represent usage/get rid of double enumeration warnings, refs AC-2646

* chore: remove org/provider service fc callers, refs AC-2646

* chore: remove collection service fc callers, refs AC-2646

* chore: remove cipher service import ciphers fc callers, refs AC-2646

* fix: UpdateOrganizationUserCommandTests collections to list, refs AC-2646

* fix: update CreateGroupCommandTests, refs AC-2646

* fix: adjust UpdateGroupCommandTests, refs AC-2646

* fix: adjust UpdateOrganizationUserCommandTests for FC always true, refs AC-2646

* fix: update CollectionServiceTests, refs AC-2646

* fix: remove unnecessary test with fc disabled, refs AC-2646

* fix: update tests to account for AccessAll removal and Manager removal, refs AC-2646

* chore: remove dependence on FC flag for tests, refs AC-2646
2024-07-12 12:25:04 -05:00

44 lines
1.1 KiB
C#

using System.Reflection;
using AutoFixture;
using AutoFixture.Xunit2;
using Bit.Core.Models.Data;
namespace Bit.Core.Test.AutoFixture;
public class CollectionAccessSelectionCustomization : ICustomization
{
public bool Manage { get; set; }
public bool ReadOnly { get; set; }
public bool HidePasswords { get; set; }
public CollectionAccessSelectionCustomization(bool manage)
{
Manage = manage;
ReadOnly = !manage;
HidePasswords = !manage;
}
public void Customize(IFixture fixture)
{
fixture.Customize<CollectionAccessSelection>(composer => composer
.With(o => o.Manage, Manage)
.With(o => o.ReadOnly, ReadOnly)
.With(o => o.HidePasswords, HidePasswords));
}
}
public class CollectionAccessSelectionCustomizeAttribute : CustomizeAttribute
{
private readonly bool _manage;
public CollectionAccessSelectionCustomizeAttribute(bool manage = false)
{
_manage = manage;
}
public override ICustomization GetCustomization(ParameterInfo parameter)
{
return new CollectionAccessSelectionCustomization(_manage);
}
}