public async Task RetrieveUsers()
        {
            var users = await usersClient.GetAll();

            Users.Clear();

            foreach (User user in users)
            {
                Users.Add(user);
            }
        }
Example #2
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UsersClient(connection);

                await client.GetAll();

                Received.InOrder(async() =>
                {
                    await connection.GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "users"));
                });
            }
Example #3
0
        public void Users()
        {
            Utils.UseApiEnvironment((_, api, token) =>
            {
                using (var baseClient = api.CreateClient())
                {
                    IUsersClient client = new UsersClient(baseClient);

                    Assert.IsFalse(client.GetAll(token).Result.Any());
                    Assert.IsNull(client.Get(token, "0").Result);
                    client.Clear(token).Wait();
                    {
                        User tag = new User {
                            Name = "user"
                        };
                        string id = client.Create(token, Guid.NewGuid().ToString(), tag).Result;
                        Assert.AreEqual(tag.Name, client.Get(token, id).Result?.Name);
                        tag.Name = "user2";
                        Assert.IsNotNull(client.Update(token, id, tag).Result);
                        Assert.IsNotNull(client.Delete(token, id).Result);
                    }
                }
            });
        }