Ejemplo n.º 1
0
        public async Task UpdateLabel()
        {
            var label = await _labelsApi.CreateLabel(GenerateName("Cool Resource"), new Dictionary <string, string>(),
                                                     _organization.Id);

            Assert.IsNull(label.Properties);

            label.Properties = new Dictionary <string, string> {
                { "color", "blue" }
            };

            label = await _labelsApi.UpdateLabel(label);

            Assert.AreEqual(1, label.Properties.Count);
            Assert.AreEqual("blue", label.Properties["color"]);

            label.Properties.Add("type", "free");

            label = await _labelsApi.UpdateLabel(label);

            Assert.AreEqual(2, label.Properties.Count);
            Assert.AreEqual("blue", label.Properties["color"]);
            Assert.AreEqual("free", label.Properties["type"]);

            label.Properties["type"]  = "paid";
            label.Properties["color"] = "";

            label = await _labelsApi.UpdateLabel(label);

            Assert.AreEqual(1, label.Properties.Count);
            Assert.AreEqual("paid", label.Properties["type"]);
        }