Наследование: DbContext
Пример #1
0
        public void Resources_HasAllPermissionActionTitles()
        {
            ResourceManager manager = MvcTemplate.Resources.Permission.Action.Titles.ResourceManager;
            using (Context context = new Context(ConfigurationFactory.Create()))
            {
                String[] actions = context
                    .Set<Permission>()
                    .Select(permission => permission.Area + permission.Controller + permission.Action)
                    .Distinct()
                    .ToArray();

                foreach (String action in actions)
                    Assert.True(!String.IsNullOrEmpty(manager.GetString(action)),
                        $"Permission action '{action}', does not have a title.");
            }
        }
Пример #2
0
        public void Resources_HasAllPrivilegeActionTitles()
        {
            ResourceManager manager = MvcTemplate.Resources.Privilege.Action.Titles.ResourceManager;
            using (Context context = new Context())
            {
                String[] actions = context
                    .Set<Privilege>()
                    .Select(priv => priv.Area + priv.Controller + priv.Action)
                    .Distinct()
                    .ToArray();

                foreach (String action in actions)
                    Assert.True(!String.IsNullOrEmpty(manager.GetString(action)),
                        String.Format("Privilege action '{0}', does not have a title.", action));
            }
        }
Пример #3
0
        public void Resources_HasAllPermissionControllerTitles()
        {
            ResourceManager manager = MvcTemplate.Resources.Permission.Controller.Titles.ResourceManager;
            using (Context context = new Context())
            {
                String[] controllers = context
                    .Set<Permission>()
                    .Select(permission => permission.Area + permission.Controller)
                    .Distinct()
                    .ToArray();

                foreach (String controller in controllers)
                    Assert.True(!String.IsNullOrEmpty(manager.GetString(controller)),
                        String.Format("Permission controller '{0}', does not have a title.", controller));
            }
        }
Пример #4
0
        public void Resources_HasAllPermissionAreaTitles()
        {
            ResourceManager manager = MvcTemplate.Resources.Permission.Area.Titles.ResourceManager;
            using (Context context = new Context())
            {
                String[] areas = context
                    .Set<Permission>()
                    .Select(permission => permission.Area)
                    .Distinct()
                    .ToArray();

                foreach (String area in areas)
                    Assert.True(!String.IsNullOrEmpty(manager.GetString(area)),
                        String.Format("Permission area '{0}', does not have a title.", area));
            }
        }
Пример #5
0
 public InitialDataTests()
 {
     context = new Context();
 }
Пример #6
0
 public InitialDataTests()
 {
     context = new Context(ConfigurationFactory.Create());
 }