Exemple #1
0
        public static void ClassInit(TestContext context)
        {
            var solutionDir = Path.GetDirectoryName(Path.GetDirectoryName(context.TestDir));
            var tempDir     = Path.Combine(solutionDir, "crema_repo", "permission_test", "type_guest");
            var empty       = DirectoryUtility.Exists(tempDir) == false || DirectoryUtility.IsEmpty(tempDir);

            cremaHost = TestCrema.GetInstance(tempDir);
            cremaHost.Open();

            if (empty == true)
            {
                CremaSimpleGenerator.Generate(cremaHost, 10);
            }

            cremaHost.Dispatcher.Invoke(() =>
            {
                var userContext = cremaHost.GetService <IUserContext>();

                foreach (var item in userContext.Users)
                {
                    var authentication = cremaHost.Login(item.ID, item.Authority.ToString().ToLower());
                    users.Add(item, authentication);
                }
            });
        }
Exemple #2
0
        public static Authentication Start(this ICremaHost cremaHost)
        {
#if SERVER
            var token          = cremaHost.Open();
            var authentication = cremaHost.Login("admin", Utility.AdminPassword);
            authenticationToToken.Add(authentication, token);
            return(authentication);
#endif
#if CLIENT
            var port           = cremaHostToPort[cremaHost];
            var token          = cremaHost.Open($"localhost:{port}", "admin", Utility.AdminPassword);
            var authentication = cremaHost.GetService(typeof(Authenticator)) as Authenticator;
            authenticationToToken.Add(authentication, token);
            return(authentication);
#endif
        }
Exemple #3
0
        public static void ClassInit(TestContext context)
        {
            var solutionDir = Path.GetDirectoryName(Path.GetDirectoryName(context.TestDir));
            var tempDir     = Path.Combine(solutionDir, "crema_repo", "permission_test", typeof(PermissionTest).Name);
            var empty       = DirectoryUtility.Exists(tempDir) == false || DirectoryUtility.IsEmpty(tempDir);

            cremaHost = TestCrema.GetInstance(tempDir);
            cremaHost.Open();

            if (empty == true)
            {
                CremaSimpleGenerator.Generate(cremaHost, 10);
            }

            users.Initialize(cremaHost);
        }
Exemple #4
0
 public void Initialize()
 {
     cremaHost = TestCrema.CreateInstance(tempDir);
     cremaHost.Open();
 }
Exemple #5
0
 public void Initialize()
 {
     cremaHost.Open();
 }