Esempio n. 1
0
        private void TestDsDataRetrieved(GigyaDsSettings dsSettings)
        {
            dynamic gigyaModel = new ExpandoObject();

            gigyaModel.UID = _dsUid;

            var settings = new GigyaModuleSettings
            {
                Id                = -1,
                ApiKey            = _dsApiKey,
                ApplicationKey    = _dsUserKey,
                ApplicationSecret = _dsSecret,
                MappingFields     = string.Empty,
                DataCenter        = "eu1.gigya.com"
            };

            //var settingsHelper = new Mock<GigyaDsSettingsHelper>(_logger);
            //settingsHelper.Setup(i => i.Get(It.IsAny<string>())).Returns(dsSettings);

            var mappingFields = new List <MappingField>();

            var helper = new GigyaDsHelper(settings, _logger, dsSettings);
            var result = helper.Merge(gigyaModel, mappingFields);

            Assert.IsNotNull(result);
            Assert.IsTrue(mappingFields.Any(), "Mapping fields not added");

            // verify all the fields
            Assert.AreEqual(30, result.ds.dsTesting.age_i);
            Assert.AreEqual("david", result.ds.dsTesting.firstName_s);
            Assert.AreEqual("1978-07-22", result.ds.dsTesting.birthDate_d);
            Assert.AreEqual("MBA", result.ds.dsTesting.academicDegree.degree_s);
        }
Esempio n. 2
0
        /// <summary>
        /// Event that is called whenever the user's data is retrieved with getAccountInfo.
        /// This method retrieves the ds data and merges it with the getAccountInfo object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void GigyaEventHub_GetAccountInfoCompleted(object sender, GetAccountInfoCompletedEventArgs e)
        {
            var settingsHelper = new GigyaUmbracoDsSettingsHelper(e.Logger);
            var settings       = settingsHelper.Get(Convert.ToInt32(e.CurrentSiteId));

            // merge ds data with account info
            var helper = new GigyaDsHelper(e.Settings, e.Logger, settings);

            e.GigyaModel = helper.Merge(e.GigyaModel, e.MappingFields);
        }