Esempio n. 1
0
        public void GetAllUsersFromAllDomainsTest()
        {
            OAuth2DomainUser userA = new OAuth2DomainUser()
            {
                domain = domainNameString, userName = "******"
            };
            OAuth2DomainUser userB = new OAuth2DomainUser()
            {
                domain = "domainB", userName = "******"
            };

            consumer.SetUser(domainNameString, userA);
            var domainB = new OAuth2Domain()
            {
                domain = "domainB"
            };

            consumer.SetDomain(domainB);
            consumer.SetUser("domainB", userB);

            List <OAuth2DomainUser> result = consumer.GetAllUsers().ToList();

            Assert.AreEqual(result.Count, 3);
            Assert.Contains(domainUserObj, result);
            Assert.Contains(userA, result);
            Assert.Contains(userB, result);
        }
Esempio n. 2
0
        public void SetUserTest()
        {
            string newUserName = "******";

            OAuth2DomainUser user = new OAuth2DomainUser()
            {
                domain = domainNameString, userName = newUserName
            };

            consumer.SetUser(domainNameString, user);

            Assert.IsTrue(consumer.UserExists(domainNameString, newUserName));
        }
Esempio n. 3
0
        public void Init()
        {
            //manually set up the dataStore
            dataStore = new TestDataStore();

            tokenInfoObj = new OAuth2TokenInfo()
            {
                token       = tokenResponseObj,
                tokenString = tokenStringString
            };

            tokenResponseObj = new TokenResponse()
            {
                AccessToken = accessTokenString
            };

            clientSecretsObj = new ClientSecrets()
            {
                ClientId = clientIdString, ClientSecret = clientSecretString
            };

            domainUserObj = new OAuth2DomainUser()
            {
                clientSecrets = clientSecretsObj, domain = domainNameString, userName = userNameString
            };

            domainUserObj.tokenAndScopesByApi.Add(apiString, tokenInfoObj);

            domainObj = new OAuth2Domain()
            {
                defaultUser = userNameString
            };

            domainObj.users.Add(userNameString, domainUserObj);

            var internalInfo = new OAuth2Info()
            {
                defaultDomain = domainNameString, defaultClientSecrets = clientSecretsObj
            };

            internalInfo.domains.Add(domainNameString, domainObj);

            dataStore.internalInfo = internalInfo;

            consumer = new OAuth2InfoConsumer(dataStore);
        }