public void AssertUserHasCapability_throws_if_capability_is_not_a_flags_enum(RequiredCapabilityTester <SampleEntity, NotAFlagsEnum> sut,
                                                                              IIdentity <User> userId,
                                                                              IIdentity <SampleEntity> entityId,
                                                                              NotAFlagsEnum cap)
 {
     Assert.That(() => sut.AssertUserHasCapability(userId, entityId, cap), Throws.Exception);
 }
        public void AssertUserHasCapability_throws_nothing_if_user_has_all_required_capabilities([Frozen] IGetsUserCapabilities <SampleEntity, SampleEntityCapability> capabilitiesProvider,
                                                                                                 RequiredCapabilityTester <SampleEntity, SampleEntityCapability> sut,
                                                                                                 IIdentity <User> userId,
                                                                                                 IIdentity <SampleEntity> entityId)
        {
            Mock.Get(capabilitiesProvider)
            .Setup(x => x.GetCapabilities(userId, entityId))
            .Returns(SampleEntityCapability.Two | SampleEntityCapability.One);

            Assert.That(() => sut.AssertUserHasCapability(userId, entityId, SampleEntityCapability.Two | SampleEntityCapability.One),
                        Throws.Nothing);
        }
        public void AssertUserHasCapability_throws_UserMustHaveCapabilityException_if_user_does_not_have_all_required_capabilities([Frozen] IGetsUserCapabilities <SampleEntity, SampleEntityCapability> capabilitiesProvider,
                                                                                                                                   RequiredCapabilityTester <SampleEntity, SampleEntityCapability> sut,
                                                                                                                                   IIdentity <User> userId,
                                                                                                                                   IIdentity <SampleEntity> entityId)
        {
            Mock.Get(capabilitiesProvider)
            .Setup(x => x.GetCapabilities(userId, entityId))
            .Returns(SampleEntityCapability.Two);

            Assert.That(() => sut.AssertUserHasCapability(userId, entityId, SampleEntityCapability.One | SampleEntityCapability.Two),
                        Throws.InstanceOf <UserMustHaveCapabilityException>());
        }