mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
58413e2ff0
* Added SsoConfigService tests
* Cleanup whitespace in SsoConfigServiceTests
* Work on PolicyServiceTests
* Refactor PolicyService to remove uneeded calls
* Implement Code Coverage
* Continued work on PolicyServiceTests
* Revert "Implement Code Coverage"
This reverts commit 4ada179ada
.
* Fix PolicyServiceTests after rebasing
* Cleanup unused namespaces
* Added assertions that saving or logging of save aren't happening on exceptions
42 lines
1007 B
C#
42 lines
1007 B
C#
using System;
|
|
using System.Reflection;
|
|
using AutoFixture;
|
|
using AutoFixture.Xunit2;
|
|
using Bit.Core.Enums;
|
|
|
|
namespace Bit.Core.Test.AutoFixture.OrganizationUserFixtures
|
|
{
|
|
internal class Policy : ICustomization
|
|
{
|
|
public PolicyType Type { get; set; }
|
|
|
|
public Policy(PolicyType type)
|
|
{
|
|
Type = type;
|
|
}
|
|
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<Core.Models.Table.Policy>(composer => composer
|
|
.With(o => o.OrganizationId, Guid.NewGuid())
|
|
.With(o => o.Type, Type)
|
|
.With(o => o.Enabled, true));
|
|
}
|
|
}
|
|
|
|
public class PolicyAttribute : CustomizeAttribute
|
|
{
|
|
private readonly PolicyType _type;
|
|
|
|
public PolicyAttribute(PolicyType type)
|
|
{
|
|
_type = type;
|
|
}
|
|
|
|
public override ICustomization GetCustomization(ParameterInfo parameter)
|
|
{
|
|
return new Policy(_type);
|
|
}
|
|
}
|
|
}
|