コード例 #1
0
        public void Should_Get_NewUser_When_Requesting_As_Self()
        {
            IIdentityProvider provider = new IdentityProvider(new RackspaceCloudIdentity { Username = _testUser.Username, Password = _newTestUserPassword });

            var user = provider.GetUser(_testUser.Id);

            Assert.IsNotNull(user);
        }
コード例 #2
0
        public void Should_Throw_Exception_When_Trying_To_Get_Details_Of_A_Different_User_When_Retrieving_User_By_Id_With_Non_Admin_Account()
        {
            IIdentityProvider serviceProvider = new IdentityProvider(_testIdentity);

            try
            {
                var details = serviceProvider.GetUser(_adminUserDetails.Id);

                throw new Exception("This code path is invalid, exception was expected.");
            }
            catch (net.openstack.Core.Exceptions.Response.ResponseException)
            {
                Assert.IsTrue(true);
            }
        }
コード例 #3
0
        public void Should_Throw_Exception_When_Requesting_The_NewUser_After_It_Has_Been_Deleted_When_Requesting_As_User_Admin()
        {
            IIdentityProvider provider = new IdentityProvider(_testIdentity);

            try
            {
                provider.GetUser(_testUser.Id);

                throw new Exception("This code path is invalid, exception was expected.");
            }
            catch(Exception ex)
            {
                Assert.IsTrue(true);
            }
        }
コード例 #4
0
        public void Should_List_Details_Of_Other_User_When_Retrieving_User_By_Id_With_Admin_Account()
        {
            IIdentityProvider serviceProvider = new IdentityProvider(_testAdminIdentity);

            var details = serviceProvider.GetUser(_userDetails.Id);

            Assert.IsNotNull(details);
            Assert.AreEqual(_testIdentity.Username, details.Username);
        }