Пример #1
0
        public static Config CreateConfig(this Environment env, string code)
        {
            Config conf = new Config(code, env);

            env.Configs.Add(conf);
            return(conf);
        }
Пример #2
0
        protected override void SeedData(ObjectConfigContext context, MockUserProvider userProvider)
        {
            Application app1   = DataSeed.Application1;
            Application app2   = DataSeed.Application2;
            User        viewer = DataSeed.UserViewer1;
            User        admin  = DataSeed.UserAdmin1;

            context.UsersApplications.Add(new UsersApplications(viewer, app1, ApplicationRole.Viewer));
            context.UsersApplications.Add(new UsersApplications(userProvider.User, app1,
                                                                ApplicationRole.Administrator));
            context.UsersApplications.Add(new UsersApplications(userProvider.User, app2, ApplicationRole.Viewer));

            _env1 = DataSeed.Environment1(app1);
            _env2 = DataSeed.Environment2(app1);

            context.UsersEnvironments.Add(new UsersEnvironments(admin, _env1, EnvironmentRole.Editor));
            context.UsersEnvironments.Add(new UsersEnvironments(admin, _env2, EnvironmentRole.Editor));

            context.UsersEnvironments.Add(new UsersEnvironments(userProvider.User, _env1, EnvironmentRole.TargetEditor));
            context.UsersEnvironments.Add(new UsersEnvironments(userProvider.User, _env2, EnvironmentRole.Editor));

            _env1.CreateConfig("conf1");
            _env1.CreateConfig("conf2");
            _env1.CreateConfig("conf3");
        }
Пример #3
0
        protected override void SeedData(ObjectConfigContext context, MockUserProvider userProvider)
        {
            Application app1 = DataSeed.Application1;
            Application app2 = DataSeed.Application2;

            ObjectConfig.Data.User viewer = DataSeed.UserViewer1;
            ObjectConfig.Data.User admin  = DataSeed.UserAdmin1;

            context.UsersApplications.Add(new UsersApplications(viewer, app1, ApplicationRole.Viewer));
            context.UsersApplications.Add(new UsersApplications(userProvider.User, app1, ApplicationRole.Administrator));
            context.UsersApplications.Add(new UsersApplications(userProvider.User, app2, ApplicationRole.Viewer));

            ObjectConfig.Data.Environment env1 = DataSeed.Environment1(app1);
            ObjectConfig.Data.Environment env2 = DataSeed.Environment2(app1);
            ForUpdateEnv = DataSeed.Environment3(app1);

            context.UsersEnvironments.Add(new UsersEnvironments(admin, env1, EnvironmentRole.Editor));
            context.UsersEnvironments.Add(new UsersEnvironments(admin, env2, EnvironmentRole.Editor));
            context.UsersEnvironments.Add(new UsersEnvironments(admin, ForUpdateEnv, EnvironmentRole.Editor));

            context.UsersEnvironments.Add(new UsersEnvironments(userProvider.User, env1, EnvironmentRole.TargetEditor));
            context.UsersEnvironments.Add(new UsersEnvironments(userProvider.User, env2, EnvironmentRole.TargetEditor));
            context.UsersEnvironments.Add(new UsersEnvironments(userProvider.User, ForUpdateEnv, EnvironmentRole.TargetEditor));

            _app2Env1 = DataSeed.Environment1(app2);
            context.UsersEnvironments.Add(new UsersEnvironments(admin, _app2Env1, EnvironmentRole.Editor));
        }