示例#1
0
        public void ShouldManageGroupLifecycle()
        {
            var client = new Client(Organization, Application);

            client.Login(ClientId, ClientSecret, AuthType.Organization);

            var group = client.GetGroup <MyUsergridGroup>("group1");

            if (group != null)
            {
                client.DeleteGroup("group1");
            }

            group = new MyUsergridGroup {
                Path = "group1", Title = "title1", Description = "desc1"
            };
            client.CreateGroup(group);
            group = client.GetGroup <MyUsergridGroup>("group1");

            Assert.IsNotNull(group);
            Assert.AreEqual("group1", group.Path);
            Assert.AreEqual("title1", group.Title);
            Assert.AreEqual("desc1", group.Description);

            group.Description = "desc2";
            group.Title       = "title2";

            client.UpdateGroup(group);

            group = client.GetGroup <MyUsergridGroup>("group1");

            Assert.IsNotNull(group);
            Assert.AreEqual("group1", group.Path);
            Assert.AreEqual("title2", group.Title);
            Assert.AreEqual("desc2", group.Description);

            client.DeleteGroup("group1");

            group = client.GetGroup <MyUsergridGroup>("group1");
            Assert.IsNull(group);
        }
示例#2
0
        public void ShouldManageGroupLifecycle()
        {
            var client = new Client(Organization, Application);
            client.Login(ClientId, ClientSecret, AuthType.Organization);

            var group = client.GetGroup<MyUsergridGroup>("group1");

            if (group != null)
                client.DeleteGroup("group1");

            group = new MyUsergridGroup {Path = "group1", Title = "title1", Description = "desc1"};
            client.CreateGroup(group);
            group = client.GetGroup<MyUsergridGroup>("group1");

            Assert.IsNotNull(group);
            Assert.AreEqual("group1", group.Path);
            Assert.AreEqual("title1", group.Title);
            Assert.AreEqual("desc1", group.Description);

            group.Description = "desc2";
            group.Title = "title2";

            client.UpdateGroup(group);

            group = client.GetGroup<MyUsergridGroup>("group1");

            Assert.IsNotNull(group);
            Assert.AreEqual("group1", group.Path);
            Assert.AreEqual("title2", group.Title);
            Assert.AreEqual("desc2", group.Description);

            client.DeleteGroup("group1");

            group = client.GetGroup<MyUsergridGroup>("group1");
            Assert.IsNull(group);
        }