Пример #1
0
        public void CreateModifyDeleteMessageType()
        {
            if (!Settings.ModifyTests)
            {
                return;
            }
            string name  = "Test message type";
            string icon  = "t";
            string name2 = "Altered message type";
            string icon2 = "a";
            ApiList <MessageType> messages = RunTest(MessageType.GetMessageTypes(Api, Settings.TestProject));
            List <MessageType>    all      = messages.All(Api).ToList();
            MessageType           d        = all.FirstOrDefault(x => x.name == name);

            if (d != null)
            {
                d.Destroy(Api, Settings.TestProject).Wait();
            }
            d = all.FirstOrDefault(x => x.name == name2);
            if (d != null)
            {
                d.Destroy(Api, Settings.TestProject).Wait();
            }
            MessageType m = MessageType.Create(Api, Settings.TestProject, name, icon).Result;

            Assert.AreEqual(name, m.name);
            Assert.AreEqual(icon, m.icon);
            MessageType changed = m.Update(Api, Settings.TestProject, name2, icon2).Result;

            Assert.AreEqual(name2, changed.name);
            Assert.AreEqual(icon2, changed.icon);
            changed.Destroy(Api, Settings.TestProject).Wait();
        }