예제 #1
0
        public void Can_Delete()
        {
            var content = CreateTestData(3).ToArray();

            var provider   = new PetaPocoUnitOfWorkProvider(Logger);
            var unitOfWork = provider.GetUnitOfWork();

            using (var repo = new PublicAccessRepository(unitOfWork, CacheHelper, Logger, SqlSyntax))
            {
                var entry = new PublicAccessEntry(content[0], content[1], content[2], new[]
                {
                    new PublicAccessRule
                    {
                        RuleValue = "test",
                        RuleType  = "RoleName"
                    },
                });
                repo.AddOrUpdate(entry);
                unitOfWork.Commit();

                repo.Delete(entry);
                unitOfWork.Commit();

                entry = repo.Get(entry.Key);
                Assert.IsNull(entry);
            }
        }
        public void Can_Delete()
        {
            var content = CreateTestData(3).ToArray();

            var provider = TestObjects.GetScopeProvider(Logger);

            using (var scope = provider.CreateScope())
            {
                var repo = new PublicAccessRepository((IScopeAccessor)provider, CacheHelper, Logger);

                var entry = new PublicAccessEntry(content[0], content[1], content[2], new[]
                {
                    new PublicAccessRule
                    {
                        RuleValue = "test",
                        RuleType  = "RoleName"
                    },
                });
                repo.Save(entry);


                repo.Delete(entry);


                entry = repo.Get(entry.Key);
                Assert.IsNull(entry);
            }
        }
예제 #3
0
        public void Can_Delete()
        {
            IContent[] content = CreateTestData(3).ToArray();

            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                var repo = new PublicAccessRepository((IScopeAccessor)provider, AppCaches, LoggerFactory.CreateLogger <PublicAccessRepository>());

                PublicAccessRule[] rules = new[]
                {
                    new PublicAccessRule
                    {
                        RuleValue = "test",
                        RuleType  = "RoleName"
                    },
                };
                var entry = new PublicAccessEntry(content[0], content[1], content[2], rules);
                repo.Save(entry);

                repo.Delete(entry);

                entry = repo.Get(entry.Key);
                Assert.IsNull(entry);
            }
        }