Beispiel #1
0
        private void LoadAzureCredentials()
        {
            cRndRandom = new Random(System.Environment.TickCount);
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);

            cLisUsers = new List <CreateUserArgs>();
            for (Int32 curUserIndex = 1; curUserIndex <= NOOFUSERS; curUserIndex++)
            {
                String pStrEmail = String.Format("{0}@{1}.com",
                                                 CryptographyHelpers.RandomString(12),
                                                 CryptographyHelpers.RandomString(12));
                String pStrUserName       = CryptographyHelpers.RandomString(12);
                String pStrActivationCode = CryptographyHelpers.RandomString(6);
                cLisUsers.Add(new CreateUserArgs()
                {
                    Email          = pStrEmail,
                    UserName       = pStrUserName,
                    ActivationCode = pStrActivationCode
                });
            }

            for (Int32 curUserIndex = 1; curUserIndex <= NOOFUSERS; curUserIndex++)
            {
                CreateUserArgs pCUAUser = cLisUsers[curUserIndex - 1];
                pCUAUser.Friends = new List <CreateUserArgs>();
                List <Int32> pLisIndexes = new List <Int32>();
                for (Int32 curFriendIndex = 1; curFriendIndex <= NOOFRIENDSPERUSER; curFriendIndex++)
                {
                    List <CreateUserArgs> pLisFriends = new List <CreateUserArgs>();

                    //Get a random user that isn't us
                    Int32 pIntUserIndex = cRndRandom.Next(0, NOOFUSERS);
                    while (pIntUserIndex == curFriendIndex - 1 ||
                           pLisIndexes.Contains(pIntUserIndex))
                    {
                        pIntUserIndex = cRndRandom.Next(0, NOOFUSERS);
                    }

                    pLisIndexes.Add(pIntUserIndex);
                    pCUAUser.Friends.Add(cLisUsers[pIntUserIndex]);
                }
            }
        }
        private void LoadAzureCredentials()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrEmail = String.Format("{0}@{1}.com",
                                      CryptographyHelpers.RandomString(12),
                                      CryptographyHelpers.RandomString(12));
            cStrUserName       = CryptographyHelpers.RandomString(12);
            cStrActivationCode = CryptographyHelpers.RandomString(6);
        }
Beispiel #3
0
        private void LoadAzureCredentials()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrSource = CryptographyHelpers.RandomString(8);

            //Init storage
            cStoStorage = new Storage("TableStorageRootURL",
                                      "AzureWebJobsStorage",
                                      "Test");
        }
Beispiel #4
0
        public void UpdatetUserProfile()
        {
            String pStrNewFullName = CryptographyHelpers.RandomString(12);

            devoctomy.funk.core.Membership.Profile pProProfile = cUsrUser.GetProfile(cStoStorage);
            List <String> pLisKeys = pProProfile.GetAllKeys();
            Dictionary <String, String> pDicNewValues = new Dictionary <String, String>();

            foreach (String curKey in pLisKeys)
            {
                String pStrRandom = CryptographyHelpers.RandomString(8);
                pProProfile[curKey] = pStrRandom;
                pDicNewValues.Add(curKey, pStrRandom);
            }
            Assert.IsTrue(cUsrUser.ReplaceProfile(cStoStorage,
                                                  pProProfile));
            pProProfile = cUsrUser.GetProfile(cStoStorage);
            foreach (String curKey in pLisKeys)
            {
                String pStrValue     = pProProfile[curKey];
                String pStrExpecting = pDicNewValues[curKey];
                Assert.IsTrue(pStrValue.Equals(pStrExpecting));
            }
        }
Beispiel #5
0
        public void Init()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrDefaultProfile = File.ReadAllText(@"Assets\ProfileDefaults.json");
            cStrEmail          = String.Format("{0}@{1}.com",
                                               CryptographyHelpers.RandomString(12),
                                               CryptographyHelpers.RandomString(12));
            cStrActivationCode = CryptographyHelpers.RandomString(6);

            //Create the user
            cStoStorage = new Storage("TableStorageRootURL",
                                      "AzureWebJobsStorage",
                                      "Test");
            cUsrUser = new User(GetTestUserPrincipal(), 6);
            cUsrUser.ActivationCode = cStrActivationCode;
            Assert.IsTrue(cUsrUser.Insert(cStoStorage));
        }
Beispiel #6
0
 /// <summary>
 /// Randomises the activationm code, called on construction
 /// </summary>
 /// <param name="iLength">The length in characters of the newly generated activation code</param>
 public void RandomiseActivationCode(Int32 iLength)
 {
     ActivationCode = CryptographyHelpers.RandomString(iLength);
 }