/// <summary>
        /// Obtain the key/value pairs for a ScreenViewActivity.
        /// </summary>
        /// <param name="screenView">ScreenViewActivity to turn into key/value pairs.</param>
        /// <returns>Key/value pairs representing this ContentViewActivity.</returns>
        internal static IEnumerable<KeyValuePair<string, string>> GetParameters(ScreenViewActivity screenView)
        {
            yield return KeyValuePair.Create("t", "screenview");

            foreach (var parameter in GetCommonParameters(screenView))
                yield return parameter;

            if (!String.IsNullOrEmpty(screenView.ScreenName))
                yield return KeyValuePair.Create("cd", screenView.ScreenName);
        }
        public void MeasurementActivityParameterBuilder_GetParameter_For_ScreenViewActivity_Returns_Correct_Values()
        {
            var activity = new ScreenViewActivity("page");

            var parameters = MeasurementActivityParameterBuilder.GetParameters(activity).ToDictionary(k => k.Key, v => v.Value);

            Assert.AreEqual(2, parameters.Count);
            Assert.AreEqual("screenview", parameters["t"]);
            Assert.AreEqual("page", parameters["cd"]);
        }
Esempio n. 3
0
        public void ScreenViewViewActivity_Constructor_With_Minimal_Parameters_Sets_Correct_Properties()
        {
            var activity = new ScreenViewActivity("screenName");

            Assert.AreEqual("screenName", activity.ScreenName);
        }