public void IsAuthorizedFor_CachesAccountPermissions() { Int32 accountId = CreateAccountWithPermissionFor(null, "Authorized", "Action"); context.DropData(); Assert.True(authorization.IsAuthorizedFor(accountId, null, "Authorized", "Action")); }
public MvcLookupTests() { url = Substitute.For <IUrlHelper>(); lookup = new MvcLookup <Role, RoleView>(url); using (TestingContext context = new TestingContext()) context.DropData(); }
public AuthorizationProviderTests() { authorization = new AuthorizationProvider(Assembly.GetExecutingAssembly()); context = new TestingContext(); context.DropData(); }
public void IsAuthorizedFor_CachesAccountPermissions() { Account account = CreateAccountWithPermissionFor(null, "Authorized", "Action"); using (TestingContext context = new TestingContext()) context.DropData(); Assert.True(authorization.IsAuthorizedFor(account.Id, null, "Authorized", "Action")); }
public AuthorizationProviderTests() { serviceProvider = Substitute.For <IServiceProvider>(); serviceProvider.GetService(typeof(IUnitOfWork)).Returns(info => new UnitOfWork(new TestingContext())); using (TestingContext context = new TestingContext()) context.DropData(); provider = new AuthorizationProvider(Assembly.GetExecutingAssembly(), serviceProvider); }
public SelectTests() { context = new TestingContext(); select = new Select <Role>(context.Set <Role>()); context.DropData(); SetUpData(); }
public SelectTests() { context = new TestingContext(); select = new Select <Role>(context.Set <Role>()); context.Set <Role>().Add(ObjectFactory.CreateRole()); context.DropData(); }
public void IsAuthorizedFor_CachesAccountPrivileges() { Account account = CreateAccountWithPrivilegeFor(null, "Authorized", "Action"); using (TestingContext context = new TestingContext()) context.DropData(); Assert.True(provider.IsAuthorizedFor(account.Id, null, "Authorized", "Action")); }
public RoleServiceTests() { context = new TestingContext(); service = Substitute.ForPartsOf <RoleService>(new UnitOfWork(context)); context.DropData(); SetUpData(); }
public RoleServiceTests() { context = new TestingContext(); Authorization.Provider = Substitute.For <IAuthorizationProvider>(); service = Substitute.ForPartsOf <RoleService>(new UnitOfWork(context)); context.DropData(); }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateRole(); unitOfWork = new UnitOfWork(context); context.DropData(); }
public StateServiceTests() { context = new TestingContext(); service = new StateService(new UnitOfWork(context)); context.DropData(); SetUpData(); }
public MvcDatalistTests() { HttpContext.Current = HttpContextFactory.CreateHttpContext(); url = new UrlHelper(HttpContext.Current.Request.RequestContext); datalist = new MvcDatalist <Role, RoleView>(url); using (TestingContext context = new TestingContext()) context.DropData(); }
public CountryValidatorTests() { context = new TestingContext(); validator = new CountryValidator(new UnitOfWork(context)); context.DropData(); SetUpData(); }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateRole(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.DropData(); }
public UnitOfWorkTests() { context = new TestingContext(); model = ObjectFactory.CreateTestModel(); logger = Substitute.For <IAuditLogger>(); unitOfWork = new UnitOfWork(context, logger); context.Set <TestModel>().RemoveRange(context.Set <TestModel>()); context.DropData(); }
public RoleValidatorTests() { context = new TestingContext(); validator = new RoleValidator(new UnitOfWork(context)); context.DropData(); context.Add(role = ObjectFactory.CreateRole()); context.SaveChanges(); }
public AuditLoggerTests() { context = new TestingContext(); logger = new AuditLogger(context, 1); TestModel model = ObjectFactory.CreateTestModel(); TestingContext dataContext = new TestingContext(); entry = dataContext.Entry <BaseModel>(dataContext.Set <TestModel>().Add(model)); dataContext.Set <AuditLog>().RemoveRange(dataContext.Set <AuditLog>()); dataContext.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")); }
public AccountServiceTests() { context = new TestingContext(); hasher = Substitute.For <IHasher>(); hasher.HashPassword(Arg.Any <String>()).Returns(info => info.Arg <String>() + "Hashed"); context.DropData(); SetUpData(); service = new AccountService(new UnitOfWork(context), hasher); service.CurrentAccountId = account.Id; }
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 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 LoggableEntityTests() { using (context = new TestingContext()) { context.Set <TestModel>().RemoveRange(context.Set <TestModel>()); context.Set <TestModel>().Add(ObjectFactory.CreateTestModel()); context.Set <Role>().Add(ObjectFactory.CreateRole()); context.DropData(); } context = new TestingContext(); model = context.Set <TestModel>().Single(); entry = context.Entry <BaseModel>(model); }
public BaseLookupTests() { urlHelper = Substitute.For <IUrlHelper>(); lookup = new BaseLookupProxy <Role, RoleView>(urlHelper); using (TestingContext context = new TestingContext()) context.DropData(); }