public Application Get(int id)
        {
            var applicationAccess = new ApplicationAccess();
            var applicationDB     = applicationAccess.Get(id);

            return(DBToLogic(applicationDB));
        }
예제 #2
0
        public static void Initialize(TestContext context)
        {
            testHelpers       = new TestHelpers();
            applicationAccess = new ApplicationAccess();
            db = new BandItEntities();

            testHelpers.ClearData();
            testHelpers.InsertTestData();
        }
        public void Add(Application application)
        {
            var applicationAccess = new ApplicationAccess();
            var applicationDB     = applicationAccess.Get(application.ID);

            if (applicationDB == null)
            {
                applicationAccess.Add(LogicToDB(application));
            }
        }
예제 #4
0
        /// <summary>
        /// Создаю модель приложения и фиксирую в трекере базы
        /// </summary>
        /// <returns></returns>
        public static ApplicationAccess ApplicationAccessCreate()
        {
            var result = default(ApplicationAccess);

            DCT.DCT.Execute(c =>
            {
                result           = new ApplicationAccess();
                result.StateEnum = ApplicationState.Enable;
            });
            return(result);
        }
예제 #5
0
        public static void Initialize(TestContext context)
        {
            testHelpers           = new TestHelpers();
            applicationController = new ApplicationController();
            bandController        = new BandController();
            userController        = new UserController();
            db = new ModelsDB.BandItEntities();
            applicationAccess = new ApplicationAccess();

            testHelpers.ClearData();
            testHelpers.InsertTestData();
        }
        public List <Application> Get()
        {
            var applicationAccess = new ApplicationAccess();
            var applicationsDB    = applicationAccess.Get();
            var applicationsLogic = new List <Application>();

            for (int i = 0; i < applicationsDB.Count; i++)
            {
                applicationsLogic.Add(DBToLogic(applicationsDB[i]));
            }

            return(applicationsLogic);
        }
예제 #7
0
        public void TestCanUpdateModifiableAppType_ViaApi(bool canUpdate)
        {
            Definition  entityType;
            UserAccount userAccount;
            string      solutionName = "TestSolution" + Guid.NewGuid();

            using (new SecurityBypassContext())
            {
                var solution = new Solution
                {
                    Name = solutionName,
                    CanModifyApplication = true
                };
                solution.Save();

                entityType = new Definition {
                    InSolution = solution
                };
                entityType.Save();

                userAccount = Entity.GetByField <UserAccount>(SpecialStrings.TenantAdministratorUser, false, new EntityRef("core", "name")).FirstOrDefault();

                var context = RequestContext.GetContext();

                ApplicationAccess.ChangeTenantApplicationCanModify(context.Tenant.Name, solutionName, canUpdate);

                CacheManager.ClearCaches();
            }

            using (new SetUser(userAccount))
            {
                // Modify the type
                entityType.Description = "New Description";

                Assert.That(() => entityType.Save(),
                            canUpdate
                        ? (Constraint)Throws.Nothing
                        : Throws.TypeOf <PlatformSecurityException>());
            }
        }
 public ApplicationController()
 {
     applicationAccess  = new ApplicationAccess();
     bandUserController = new BandUserController();
 }