public void Can_Fetch_Only_The_Rows_The_User_Is_Allowed_By_Row_Level_Security()
        {
            // TODO: Setup test?

            using (var context = new AppDbContext("SimpleMembership"))
            {
                IUnitOfWorkAsync unitOfWork = new UnitOfWork(context, new RowAuthPoliciesContainer());

                IRowAuthPoliciesContainer container = RowAuthPoliciesContainer.ConfigureRowAuthPolicies();

                container.Register <Operation, string>(o => o.Name).When(GetWhenCriteria).Match(GetMatchingCriteria);

                IRepositoryAsync <Operation> operationRepository = new Repository <Operation>(context, unitOfWork, container);

                var coperationVanilla = operationRepository.Find(1);

                var coperation  = operationRepository.FindWithRowLevelSecurity(1);
                var coperations = operationRepository.QueryableWithRowLevelSecurity().ToList();

                Assert.IsTrue(coperations.Count > 0);
                Assert.IsNotNull(coperations);

                TestContext.WriteLine("Operation found: {0}", coperation.Name);
                TestContext.WriteLine("Operations found: {0}", coperations.Count);

                // TODO: idempotent teardown
            }
        }
        public void Insert_Several_Operations()
        {
            // TODO: idempotent teardown
            // TODO: Setup test?

            using (var context = new AppDbContext())
            {
                IUnitOfWorkAsync          unitOfWork = new UnitOfWork(context, new RowAuthPoliciesContainer());
                IRowAuthPoliciesContainer container  = RowAuthPoliciesContainer.ConfigureRowAuthPolicies();

                container.Register <Operation, string>(o => o.Name).When(GetWhenCriteria).Match(GetMatchingCriteria);
                IRepositoryAsync <Operation> operationRepository = new Repository <Operation>(context, unitOfWork, container);

                var operations = new[]
                {
                    new Operation {
                        Name = "Operation1Test1", Description = "Operation1Test1", TrackingState = TrackingState.Added
                    },
                    new Operation {
                        Name = "Operation2Test2", Description = "Operation2Test2", TrackingState = TrackingState.Added
                    },
                };

                foreach (var operation in operations)
                {
                    try
                    {
                        operationRepository.Insert(operation);
                        unitOfWork.SaveChanges();
                    }
                    catch (DbEntityValidationException ex)
                    {
                        ReportError(ex);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                        TestContext.WriteLine(ex.Message);
                    }
                }

                var insertedOperation = operationRepository.Query(x => x.Name == "One").Select().FirstOrDefault();
                Assert.IsTrue(insertedOperation?.Name == "One");
                var insertedOperation2 = operationRepository.Query(x => x.Name == "Two").Select().FirstOrDefault();
                Assert.IsTrue(insertedOperation2?.Name == "Two");
            }
        }