示例#1
0
 public void ConcatenateQueryStrings()
 {
     Assert.That(EditorMeasurement.ConcatenateQueryStrings(null, null), Is.EqualTo(null));
     Assert.That(EditorMeasurement.ConcatenateQueryStrings("foo", null), Is.EqualTo("foo"));
     Assert.That(EditorMeasurement.ConcatenateQueryStrings(null, "foo"), Is.EqualTo("foo"));
     Assert.That(EditorMeasurement.ConcatenateQueryStrings(null, "foo"), Is.EqualTo("foo"));
     Assert.That(EditorMeasurement.ConcatenateQueryStrings("foo=bar", "bish=bosh"),
                 Is.EqualTo("foo=bar&bish=bosh"));
     Assert.That(EditorMeasurement.ConcatenateQueryStrings("?foo=bar&", "bish=bosh"),
                 Is.EqualTo("foo=bar&bish=bosh"));
 }
示例#2
0
        /// <summary>
        /// Create a list of expected URL and form strings for the Google Analytics v1 measurement
        /// protocol using the system and project cookies.
        /// </summary>
        /// <param name="analytics">Object to get cookies from.</param>
        /// <param name="reportUrl">URL being reported.</param>
        /// <param name="reportName">Name / title of the URL.</param>
        private KeyValuePair <string, string>[] CreateMeasurementEvents(
            EditorMeasurement analytics, string reportPath, string reportQuery,
            string reportAnchor, string reportName)
        {
            Func <string, string> createUrl = (string scope) => {
                return(reportPath + reportQuery + (String.IsNullOrEmpty(reportQuery) ? "?" : "&") +
                       "scope=" + scope + reportAnchor);
            };

            return(new KeyValuePair <string, string>[] {
                CreateMeasurementEvent(createUrl("project"), reportName, analytics.Cookie),
                CreateMeasurementEvent(createUrl("system"), reportName, analytics.SystemCookie),
            });
        }
示例#3
0
        /// <summary>
        /// Create an EditorMeasurement instance.
        /// </summary>
        private EditorMeasurement CreateEditorMeasurement()
        {
            var analytics = new EditorMeasurement(settings, ProjectSettings.logger, GA_TRACKING_ID,
                                                  SETTINGS_NAMESPACE, PLUGIN_NAME,
                                                  DATA_COLLECTION_DESCRIPTION, PRIVACY_POLICY);

            analytics.displayDialog = (title, message, option0, option1, option2) => {
                throw new Exception("Unexpected dialog displayed");
            };
            analytics.openUrl = (url) => {
                openedUrls.Add(url);
            };
            analytics.ReportUnityVersion  = false;
            analytics.ReportUnityPlatform = false;
            return(analytics);
        }
示例#4
0
        /// <summary>
        /// Create an EditorMeasurement instance.
        /// </summary>
        private EditorMeasurement CreateEditorMeasurement()
        {
            var analytics = new EditorMeasurement(settings, ProjectSettings.logger, GA_TRACKING_ID,
                                                  SETTINGS_NAMESPACE, PLUGIN_NAME,
                                                  DATA_COLLECTION_DESCRIPTION, PRIVACY_POLICY);

            analytics.displayDialog = (title, message, defaultOption, option0, option1, Nullable,
                                       windowWidth, windowCloseOption,
                                       complete, renderContent, renderButtons, init) => {
                throw new Exception("Unexpected dialog displayed");
            };
            analytics.openUrl = (url) => {
                openedUrls.Add(url);
            };
            analytics.ReportUnityVersion  = false;
            analytics.ReportUnityPlatform = false;
            return(analytics);
        }