public void ReturnFalseForMissingCustomData()
        {
            IAccount testAccount = null;

            using (new AutoCleanup(_fixture.Client, async c =>
            {
                testAccount = await _fixture.TestDirectory.CreateAccountAsync(NewTestAccount(c));
                return(new IResource[] { testAccount });
            }))
            {
                var filter = new RequireCustomDataFilter("foobar", true);
                filter.IsAuthorized(testAccount).Should().BeFalse();
            }
        }
        public async Task ReturnFalseForNonMatchingCustomDataAsync()
        {
            IAccount testAccount = null;

            using (new AutoCleanup(_fixture.Client, async c =>
            {
                testAccount = await _fixture.TestDirectory.CreateAccountAsync(NewTestAccount(c));
                testAccount.CustomData["foobar"] = false;
                await testAccount.SaveAsync();
                return(new IResource[] { testAccount });
            }))
            {
                var filter = new RequireCustomDataFilter("foobar", true);
                (await filter.IsAuthorizedAsync(testAccount, CancellationToken.None)).Should().BeFalse();
            }
        }
        public void ReturnTrueForMatchingCustomDataWithComparer()
        {
            IAccount testAccount = null;

            using (new AutoCleanup(_fixture.Client, async c =>
            {
                testAccount = await _fixture.TestDirectory.CreateAccountAsync(NewTestAccount(c));
                testAccount.CustomData["foobar"] = 123.456f;
                await testAccount.SaveAsync();
                return(new IResource[] { testAccount });
            }))
            {
                var filter = new RequireCustomDataFilter("foobar", 123.456f, new RoundingFloatComparer());
                filter.IsAuthorized(testAccount).Should().BeTrue();
            }
        }
        public void ReturnFalseForNullAccount()
        {
            var filter = new RequireCustomDataFilter("foobar", true);

            filter.IsAuthorized(null).Should().BeFalse();
        }
        public async Task ReturnFalseForNullAccountAsync()
        {
            var filter = new RequireCustomDataFilter("foobar", true);

            (await filter.IsAuthorizedAsync(null, CancellationToken.None)).Should().BeFalse();
        }