DropData() публичный Метод

public DropData ( ) : void
Результат void
Пример #1
0
        public BaseDatalistTests()
        {
            HttpContext.Current = HttpContextFactory.CreateHttpContext();
            urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);

            datalist = new BaseDatalistProxy<Role, RoleView>(urlHelper);
            using (TestingContext context = new TestingContext()) context.DropData();
        }
Пример #2
0
        public RoleServiceTests()
        {
            context = new TestingContext();
            Authorization.Provider = Substitute.For<IAuthorizationProvider>();
            service = Substitute.ForPartsOf<RoleService>(new UnitOfWork(context));

            context.DropData();
        }
Пример #3
0
        public SelectTests()
        {
            context = new TestingContext();
            select = new Select<Role>(context.Set<Role>());

            context.Set<Role>().Add(ObjectFactory.CreateRole());
            context.DropData();
        }
Пример #4
0
        public SelectTests()
        {
            context = new TestingContext();
            select = new Select<Role>(context.Set<Role>());

            context.DropData();
            SetUpData();
        }
        public AuthorizationProviderTests()
        {
            IServiceProvider services = Substitute.For<IServiceProvider>();
            services.GetService(typeof(IUnitOfWork)).Returns(info => new UnitOfWork(new TestingContext()));

            using (TestingContext context = new TestingContext()) context.DropData();
            authorization = new AuthorizationProvider(Assembly.GetExecutingAssembly(), services);
        }
Пример #6
0
        public UnitOfWorkTests()
        {
            context = new TestingContext();
            model = ObjectFactory.CreateRole();
            unitOfWork = new UnitOfWork(context);

            context.DropData();
        }
Пример #7
0
        public UnitOfWorkTests()
        {
            context = new TestingContext();
            model = ObjectFactory.CreateRole();
            logger = Substitute.For<IAuditLogger>();
            unitOfWork = new UnitOfWork(context, logger);

            context.DropData();
        }
        public RoleValidatorTests()
        {
            context = new TestingContext();
            validator = new RoleValidator(new UnitOfWork(context));

            context.DropData();
            role = ObjectFactory.CreateRole();
            context.Set<Role>().Add(role);
            context.SaveChanges();
        }
Пример #9
0
        public AuditLoggerTests()
        {
            context = new TestingContext();
            logger = new AuditLogger(context, 1);
            Role model = ObjectFactory.CreateRole();
            TestingContext dataContext = new TestingContext();

            entry = dataContext.Entry<BaseModel>(dataContext.Set<Role>().Add(model));
            dataContext.Set<AuditLog>().RemoveRange(dataContext.Set<AuditLog>());
            dataContext.DropData();
        }
        public AccountValidatorTests()
        {
            context = new TestingContext();
            hasher = Substitute.For<IHasher>();
            hasher.VerifyPassword(Arg.Any<String>(), Arg.Any<String>()).Returns(true);

            context.DropData();
            SetUpData();

            validator = new AccountValidator(new UnitOfWork(context), hasher);
            validator.CurrentAccountId = account.Id;
        }
        public LoggableEntityTests()
        {
            using (context = new TestingContext())
            {
                context.DropData();
                SetUpData();
            }

            context = new TestingContext();
            model = context.Set<Role>().Single();
            entry = context.Entry<BaseModel>(model);
        }
        public AccountServiceTests()
        {
            context = new TestingContext();
            hasher = Substitute.For<IHasher>();
            hasher.HashPassword(Arg.Any<String>()).Returns(info => info.Arg<String>() + "Hashed");

            context.DropData();
            SetUpData();

            Authorization.Provider = Substitute.For<IAuthorizationProvider>();
            service = new AccountService(new UnitOfWork(context), hasher);
            service.CurrentAccountId = account.Id;
        }
        public void Refresh_Permissions()
        {
            Account account = CreateAccountWithPermissionFor("Area", "Authorized", "Action");
            Assert.True(provider.IsAuthorizedFor(account.Id, "Area", "Authorized", "Action"));

            using (TestingContext context = new TestingContext()) context.DropData();
            SetUpDependencyResolver();

            provider.Refresh();

            Assert.False(provider.IsAuthorizedFor(account.Id, "Area", "Authorized", "Action"));
        }
        public void IsAuthorizedFor_CachesAccountPermissions()
        {
            Account account = CreateAccountWithPermissionFor(null, "Authorized", "Action");
            using (TestingContext context = new TestingContext()) context.DropData();

            Assert.True(provider.IsAuthorizedFor(account.Id, null, "Authorized", "Action"));
        }
 public AuthorizationProviderTests()
 {
     provider = new AuthorizationProvider(Assembly.GetExecutingAssembly());
     using (TestingContext context = new TestingContext()) context.DropData();
 }
        public void Refresh_Permissions()
        {
            Account account = CreateAccountWithPermissionFor("Area", "Authorized", "Action");
            Assert.True(authorization.IsAuthorizedFor(account.Id, "Area", "Authorized", "Action"));

            using (TestingContext context = new TestingContext()) context.DropData();

            authorization.Refresh();

            Assert.False(authorization.IsAuthorizedFor(account.Id, "Area", "Authorized", "Action"));
        }