Beispiel #1
0
        public void Categories()
        {
            Utils.UseApiEnvironment((_, api, token) =>
            {
                using (var baseClient = api.CreateClient())
                {
                    ICategoriesClient client = new CategoriesClient(baseClient);

                    Assert.IsFalse(client.GetAll(token).Result.Any());
                    Assert.IsNull(client.Get(token, 0).Result);
                    client.Clear(token).Wait();
                    {
                        Category tag = new Category {
                            Name = "tag", Color = "black"
                        };
                        int id = client.Create(token, tag).Result.Value;
                        Assert.AreEqual(tag.Name, client.Query(token, id).Result.First().Name);
                        Assert.AreEqual(tag.Color, client.Get(token, id).Result.Color);
                        tag.Color = "white";
                        Assert.IsTrue(client.Update(token, id, tag).Result.HasValue);
                        Assert.IsTrue(client.Delete(token, id).Result.HasValue);
                    }
                }
            });
        }