Exemplo n.º 1
0
 public async Task Can_login_securely()
 {
     using (IActorDbClient client = new ActorDbClient())
     {
         Assert.True(await client.LoginSecureAsync("myuser", "mypass"));
     }
 }
Exemplo n.º 2
0
        public async Task Can_create_and_delete_user()
        {
            using (IActorDbClient client = await ActorDbClient.BeginSession("root", "rootpass"))
            {
                var acl = new KeyValuePair <string, ActorPermissions>("*", ActorPermissions.Read | ActorPermissions.Write);

                var username = $"{Guid.NewGuid()}";

                var create = await client.CreateUserAsync(username, "mypass2", acl);

                Assert.Equal(CreateUserResult.Success, create);

                var exists = await client.CreateUserAsync(username, "mypass2", acl);

                Assert.Equal(CreateUserResult.Exists, exists);

                var delete = await client.DeleteUserAsync(username);

                Assert.Equal(DeleteUserResult.Success, delete);

                var gone = await client.DeleteUserAsync(username);

                Assert.Equal(DeleteUserResult.DoesNotExist, gone);
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetVersionAsync()
        {
            using (var client = new ActorDbClient(_settings.Value.Host, _settings.Value.Port, _logger))
            {
                var version = await client.GetProtocolVersionAsync();

                return(Ok(new { Version = version }));
            }
        }
Exemplo n.º 4
0
        public async Task Can_get_unique_id()
        {
            using (IActorDbClient client = await ActorDbClient.BeginSession("myuser", "mypass"))
            {
                var id = await client.GetUniqueIdAsync();

                _output.WriteLine($"{id}");
                Assert.NotNull(id);
            }
        }
Exemplo n.º 5
0
 public async Task <IActionResult> LoginAsync([FromBody] LoginModel model)
 {
     using (var client = new ActorDbClient(_settings.Value.Host, _settings.Value.Port, _logger))
     {
         if (!await client.LoginSecureAsync(model.Username, model.Password))
         {
             return(Forbid());
         }
         return(Ok());
     }
 }
Exemplo n.º 6
0
        public async Task Can_get_protocol_version()
        {
            using (IActorDbClient client = new ActorDbClient())
            {
                var version = await client.GetProtocolVersionAsync();

                Assert.NotNull(version);
                Assert.NotEmpty(version);
                _output.WriteLine(version);
            }
        }
Exemplo n.º 7
0
        public async Task Can_get_configuration()
        {
            using (IActorDbClient client = await ActorDbClient.BeginSession("root", "rootpass"))
            {
                var config = await client.GetConfigurationAsync();

                Assert.NotNull(config);

                _output.WriteLine(JsonConvert.SerializeObject(config));
            }
        }
Exemplo n.º 8
0
        public async Task Can_get_actor_types()
        {
            using (IActorDbClient client = await ActorDbClient.BeginSession("myuser", "mypass"))
            {
                var types = await client.GetActorTypesAsync();

                foreach (var type in types)
                {
                    _output.WriteLine(type);
                }
                Assert.NotNull(types);
            }
        }