Ejemplo n.º 1
0
        public void Include_profiles_section_if_profiles_recorded()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
            {
                new Profile {
                    Name = "Foo", PatternCard = "pattern card 1", Values = "values here"
                },
                new Profile {
                    Name = "Bar", PatternCard = string.Empty, Values = "values here"
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => x.Columns.First().Data.ToString().Contains("Profiles"));

            Assert.True(sectionFound);
        }
        public void Show_matched_patters_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
            {
                new Profile {
                    Name = "Foo", Dimension = "Product Interest", IsMatch = false
                },
                new Profile {
                    Name = "Bar", Dimension = "Product Interest", IsMatch = true
                },
                new Profile {
                    Name = "Low", Dimension = "Income", IsMatch = false
                },
                new Profile {
                    Name = "Medium", Dimension = "Income", IsMatch = false
                },
                new Profile {
                    Name = "High", Dimension = "Income", IsMatch = true
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;

            Assert.Equal("Product Interest: Bar, Income: High", summaryRow);
        }
Ejemplo n.º 3
0
        internal static RequestData GetPopulatedProperties(object obj)
        {
            var output = new RequestData();

            foreach (PropertyInfo property in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
            {
                if (property.GetValue(obj, null) != null)
                {
                    Type underlyingType = property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>)
                        ? Nullable.GetUnderlyingType(property.PropertyType)
                        : property.PropertyType;
                    if (underlyingType.IsEnum)
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), PropertyCasingHelper.CamelToSnake(property.GetValue(obj, null).ToString()));
                    }
                    else if (underlyingType == typeof(DateTime))
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), ((DateTime)property.GetValue(obj, null)).ToString("s"));
                    }
                    else
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), property.GetValue(obj, null));
                    }
                }
            }
            return(output);
        }
Ejemplo n.º 4
0
        public void Show_matched_patters_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
            {
                new Profile {
                    Name = "Foo", PatternCard = "Pattern Card", Values = "values"
                },
                new Profile {
                    Name = "Bar", PatternCard = null, Values = "values"
                },
                new Profile {
                    Name = "Non", PatternCard = string.Empty, Values = "values"
                },
                new Profile {
                    Name = "Plus", PatternCard = "Another pattern card", Values = "values"
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;

            Assert.Equal("Pattern Card, Another pattern card", summaryRow);
        }
        public void Include_profiles_section_if_profiles_recorded()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
            {
                new Profile {
                    Name = "Foo", Dimension = "Product Interest", IsMatch = false
                },
                new Profile {
                    Name = "Bar", Dimension = "Product Interest", IsMatch = true
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => x.Columns.First().Data.ToString().Contains("Profiles"));

            Assert.True(sectionFound);
        }
Ejemplo n.º 6
0
        public RequestData GetData()
        {
            var data = new RequestData();

            data.Add(DataKey.Item, "foo-bar");
            return(data);
        }
        public void Not_include_page_views_if_no_page_visits_recorded()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Page Views");

            Assert.False(sectionFound);
        }
Ejemplo n.º 8
0
        public AsyncHttpRequest(
            IHttpServer pServer, OSHttpRequest pRequest, OSHttpResponse pResponse,
            UUID pAgentID, TimeoutHandler pTimeoutHandler, int pTimeout)
        {
            m_lock             = new Object();
            m_requestCompleted = false;

            m_httpServer   = pServer;
            m_requestID    = UUID.Random();
            m_agentID      = pAgentID;
            m_httpRequest  = pRequest;
            m_httpResponse = pResponse;
            m_requestData  = new Hashtable();

            Hashtable headervals = new Hashtable();

            string[] querystringkeys = HttpRequest.QueryString.AllKeys;
            string[] rHeaders        = HttpRequest.Headers.AllKeys;

            string requestBody;

            using (StreamReader reader = new StreamReader(pRequest.InputStream, Encoding.UTF8))
            {
                requestBody = reader.ReadToEnd();
            }

            RequestData.Add("body", requestBody);
            RequestData.Add("uri", HttpRequest.RawUrl);
            RequestData.Add("content-type", HttpRequest.ContentType);
            RequestData.Add("http-method", HttpRequest.HttpMethod);

            foreach (string queryname in querystringkeys)
            {
                // HttpRequest.QueryString.AllKeys returns a one-item array, with a null only,
                // if passed something without an '=' in the query, such as URL/?abc or URL/?abc+def
                if (queryname != null)
                {
                    RequestData.Add(queryname, HttpRequest.QueryString[queryname]);
                }
            }

            foreach (string headername in rHeaders)
            {
                headervals[headername] = HttpRequest.Headers[headername];
            }

            RequestData.Add("headers", headervals);
            RequestData.Add("querystringkeys", querystringkeys);

            // Timeout
            m_Timeout     = pTimeoutHandler;
            m_timeout     = pTimeout;
            m_requestTime = Util.GetLongTickCount();
            TimedOut      = false;

            if (m_timeout != 0)
            {
                m_requestTimer = new Timer(TimerHandler, null, m_timeout, -1);
            }
        }
        public void Show_Visitor_Insight_as_summary_of_tab_data_by_default()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string column1 = data.Rows[0].Columns[0].Data; 
            string column2 = data.Rows[0].Columns[1].Data;

            Assert.Contains("Visitor", column1);
            Assert.Contains("Insight", column2);
        }
        public void Show_Visitor_Insight_as_summary_of_tab_data_by_default()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string column1 = data.Rows[0].Columns[0].Data;
            string column2 = data.Rows[0].Columns[1].Data;

            Assert.Contains("Visitor", column1);
            Assert.Contains("Insight", column2);
        }
        public void Returns_null_if_Sitecore_Item_not_in_request_data()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.Campaign, "Foo");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Ejemplo n.º 12
0
        public override bool VerifySign(RequestData data, string sign)
        {
            data.Remove("sign");
            data.Add("key", (Merchant as Merchant)?.Key);
            var unsigned = data.ToUrl(false, true);

            Logger.LogDebug($"unsigned:{unsigned}");
            var signed = EncryptHelper.Md5(unsigned);

            return(string.Equals(signed, sign, StringComparison.CurrentCultureIgnoreCase));
        }
Ejemplo n.º 13
0
        public void Returns_null_if_Sitecore_Item_not_in_request_data()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.Campaign, "Foo");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Ejemplo n.º 14
0
        protected string SignData(RequestData data, string key)
        {
            data.Add("key", key);
            data.Remove("sign");
            var unsigned = data.ToUrl(false, true);

            Logger.LogDebug($"unsigned:{unsigned}");
            var signed = EncryptHelper.Md5(unsigned).ToUpper();

            data.Remove("key");
            return(signed);
        }
        public void Include_page_views_if_page_visits_recorded()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.LastPages, new[]
            {
                new PageHolder(Guid.NewGuid(), DateTime.Now, "http://microsoft.com/")
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Page Views");

            Assert.True(sectionFound);
        }
        internal static RequestData GetPopulatedProperties(object obj)
        {
            var output = new RequestData();

            foreach (PropertyInfo property in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
            {
                if (property.GetValue(obj, null) != null)
                {
                    Type underlyingType = property.PropertyType.IsGenericType && property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>)
                        ? Nullable.GetUnderlyingType(property.PropertyType)
                        : property.PropertyType;
                    if (underlyingType.IsEnum)
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), PropertyCasingHelper.CamelToSnake(property.GetValue(obj, null).ToString()));
                    }
                    else if (underlyingType == typeof(DateTime))
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), ((DateTime)property.GetValue(obj, null)).ToString("s"));
                    }
                    else if (underlyingType == typeof(List <DateTime>))
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), ((List <DateTime>)property.GetValue(obj, null)).ConvertAll(x => x.ToString("s")));
                    }
                    //SurveyMonkey uses strings to represent longs (eg for any Ids)
                    else if (underlyingType == typeof(long))
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), ((long)property.GetValue(obj, null)).ToString());
                    }
                    else if (underlyingType == typeof(List <long>))
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), ((List <long>)property.GetValue(obj, null)).ConvertAll(x => x.ToString()));
                    }
                    else if (underlyingType.IsGenericType && !underlyingType.GetGenericArguments()[0].UnderlyingSystemType.IsPrimitive && underlyingType.GetGenericArguments()[0].UnderlyingSystemType != typeof(string))
                    {
                        var coll = (System.Collections.IEnumerable)property.GetValue(obj, null);

                        List <RequestData> nestedOutput = new List <RequestData>();

                        foreach (var item in coll)
                        {
                            RequestData nestedRequestData = GetPopulatedProperties(item);

                            nestedOutput.Add(nestedRequestData);
                        }
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), nestedOutput);
                    }
                    else
                    {
                        output.Add(PropertyCasingHelper.CamelToSnake(property.Name), property.GetValue(obj, null));
                    }
                }
            }
            return(output);
        }
Ejemplo n.º 17
0
        private void button2_Click(object sender, EventArgs e)
        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");
            //app.Icon = "http://atomicbride.com/Apple.gif";
            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";
            app.Icon = @"c:\apple.png";
            app.CustomTextAttributes.Add("Creator", "Apple Software");
            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");

            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");

            //nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });
            nt1.CustomTextAttributes.Add("Language", "English");
            nt1.CustomTextAttributes.Add("Timezone", "PST");

            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2065 Your docu;ment\nwas publi&shed", "File 'c:\\file.txt' was successfully published at 8:57pm.\n\nClick this notification to open the file.\n\nThis is a test of the expanding displays.");

            notification.Sticky   = false;
            notification.Priority = Priority.Emergency;
            notification.Icon     = "http://atomicbride.com/Apple.gif";
            //notification.Icon = "http://haxe.org/favicon.ico";
            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");
            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");
            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));
            notification.CoalescingID = "secretfaketest";

            //string url = "http://localhost/growl-callback.aspx";
            //string url = "mailto:[email protected]";
            string          url      = "itpc:http://www.npr.org/rss/podcast.php?id=35";
            CallbackContext callback = new CallbackContext(url);

            Growl.Connector.RequestData rd = new RequestData();
            rd.Add("Return-To-Me", "some text value");
            rd.Add("Return-To-Me2", "this is some longer value, including a \n few \n line \n breaks");
            rd.Add("Can I have spaces?", "dont know");

            growl.Notify(notification, callback, rd);
            this.textBox1.Text = "NOTIFY sent";
        }
        public void Return_null_if_analysis_overview_information_is_missing()
        {
            var requestData = new RequestData();
            var fieldList = new FieldList();
            fieldList.AddField("Foo", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
        public void Include_goals_section_if_goals_recorded()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Goals, new[]
            {
                new Goal {
                    Name = "Foo", Timestamp = DateTime.Now.AddMinutes(-10)
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Goals");

            Assert.True(sectionFound);
        }
        public void Return_null_if_analysis_overview_information_is_missing()
        {
            var requestData = new RequestData();
            var fieldList   = new FieldList();

            fieldList.AddField("Foo", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Ejemplo n.º 21
0
        private void button5_Click(object sender, EventArgs e)
        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");
            //app.Icon = "http://atomicbride.com/Apple.gif";
            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";
            app.Icon = @"c:\apple.png";
            app.CustomTextAttributes.Add("Creator", "Apple Software");
            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");

            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");

            nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });
            nt1.CustomTextAttributes.Add("Language", "English");
            nt1.CustomTextAttributes.Add("Timezone", "PST");

            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2605 Your document was published", @"File 'c:\file.txt' was successfully published at 8:57pm.");

            notification.Sticky   = false;
            notification.Priority = Priority.Emergency;
            //notification.Icon = "http://atomicbride.com/Apple.gif";
            app.Icon = @"c:\apple.png";
            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");
            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");
            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));

            string          data    = "this is my context\nthis is after a line break";
            string          type    = typeof(string).ToString();
            CallbackContext context = new CallbackContext(data, type);

            Growl.Connector.RequestData rd = new RequestData();
            rd.Add("Return-To-Me", "some text value");
            rd.Add("Return-To-Me2", "another value");

            growl.Notify(notification, context, rd);
            this.textBox1.Text = "NOTIFY sent";
        }
        public void Display_multiple_dimensions_for_profiles_section()
        {
            var requestData = new RequestData();

            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
            {
                new Profile {
                    Name = "Foo", Dimension = "Product Interest", IsMatch = false
                },
                new Profile {
                    Name = "Bar", Dimension = "Product Interest", IsMatch = true
                },
                new Profile {
                    Name = "Low", Dimension = "Income", IsMatch = false
                },
                new Profile {
                    Name = "Medium", Dimension = "Income", IsMatch = false
                },
                new Profile {
                    Name = "High", Dimension = "Income", IsMatch = true
                }
            });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var profileData     = (TabSection)data.Rows.ElementAt(2).Columns.ElementAt(1).Data;
            var incomeTitleCell = profileData.Rows.ElementAt(2).Columns.ElementAt(0).Data;

            Assert.Equal("Income", incomeTitleCell);
        }
        public void Show_Item_Path_and_Template_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();
            var fieldList = new FieldList();
            fieldList.AddField("Full Path", "/sitecore/content/foo");
            fieldList.AddField("Template Name", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;
            Assert.Contains("/sitecore/content/foo", summaryRow);
            Assert.Contains("Bar", summaryRow);
        }
Ejemplo n.º 24
0
        public void Show_Item_Path_and_Template_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();
            var fieldList   = new FieldList();

            fieldList.AddField("Full Path", "/sitecore/content/foo");
            fieldList.AddField("Template Name", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;

            Assert.Contains("/sitecore/content/foo", summaryRow);
            Assert.Contains("Bar", summaryRow);
        }
        private RequestData GetAnalyticsData()
        {
            var tracker = _trackerBuilder.Tracker;

            if (tracker.Interaction != null)
            {
                var data = new RequestData();

                data.Add(DataKey.Profiles, GetProfiles());
                data.Add(DataKey.LastPages, GetLastPages(5));
                data.Add(DataKey.Goals, GetGoals(5));
                data.Add(DataKey.Campaign, GetCampaign());
                data.Add(DataKey.TrafficType, GetTrafficType());
                data.Add(DataKey.EngagementValue, GetEngagementValue());
                data.Add(DataKey.IsNewVisitor, GetVisitType());

                return(data);
            }

            return(null);
        }
Ejemplo n.º 26
0
        private RequestData GetAnalyticsData()
        {
            if (Tracker.CurrentVisit != null)
            {
                Tracker.Visitor.LoadAll();

                var data = new RequestData();

                data.Add(DataKey.Profiles, GetProfiles());
                data.Add(DataKey.LastPages, GetLastPages(5));
                data.Add(DataKey.Goals, GetGoals(5));
                data.Add(DataKey.Campaign, GetCampaign());
                data.Add(DataKey.TrafficType, GetTrafficType());
                data.Add(DataKey.EngagementValue, GetEngagementValue());
                data.Add(DataKey.IsNewVisitor, GetVisitType());

                return(data);
            }

            return(null);
        }
        private RequestData GetAnalyticsData()
        {
            var tracker = _trackerBuilder.Tracker;

            if (tracker.Interaction != null)
            {
                

                var data = new RequestData();

                data.Add(DataKey.Profiles, GetProfiles());
                data.Add(DataKey.LastPages, GetLastPages(5));
                data.Add(DataKey.Goals, GetGoals(5));
                data.Add(DataKey.Campaign, GetCampaign());
                data.Add(DataKey.TrafficType, GetTrafficType());
                data.Add(DataKey.EngagementValue, GetEngagementValue());
                data.Add(DataKey.IsNewVisitor, GetVisitType());

                return data;
            }

            return null;
        }
        public void Not_include_page_views_if_no_page_visits_recorded()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection) _sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Page Views");
            Assert.False(sectionFound);
        }
        public void Show_matched_patters_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
                {
                    new Profile { Name = "Foo", PatternCard  = "Pattern Card", Values = "values" },
                    new Profile { Name = "Bar", PatternCard = null, Values =  "values" },
                    new Profile { Name = "Non", PatternCard = string.Empty, Values = "values" },
                      new Profile { Name = "Plus", PatternCard = "Another pattern card", Values = "values" }
                });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;
            Assert.Equal("Pattern Card, Another pattern card", summaryRow);
        }
        public void Include_profiles_section_if_profiles_recorded()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Profiles, new[]
                {
                    new Profile { Name = "Foo", PatternCard = "pattern card 1", Values = "values here" },
                    new Profile { Name = "Bar", PatternCard = string.Empty, Values = "values here" }
                });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => x.Columns.First().Data.ToString().Contains("Profiles"));
            Assert.True(sectionFound);
        }
        public void Include_goals_section_if_goals_recorded()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.Goals, new[]
                {
                    new Goal { Name = "Foo", Timestamp = DateTime.Now.AddMinutes(-10)}
                });

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Goals");
            Assert.True(sectionFound);
        }
        public void Include_page_views_if_page_visits_recorded()
        {
            var requestData = new RequestData();
            requestData.Add(DataKey.IsNewVisitor, true);
            requestData.Add(DataKey.EngagementValue, 0);
            requestData.Add(DataKey.TrafficType, "Returning");

            requestData.Add(DataKey.LastPages, new[]
                {
                    new PageHolder(1,Guid.NewGuid(), DateTime.Now, "http://microsoft.com/")
                } );

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = (TabSection)_sut.GetData(null);

            var sectionFound = data.Rows.Any(x => (string)x.Columns.First().Data == "Page Views");
            Assert.True(sectionFound);
        }
Ejemplo n.º 33
0
        private void button5_Click(object sender, EventArgs e)
        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");
            //app.Icon = "http://atomicbride.com/Apple.gif";
            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";
            app.Icon = @"c:\apple.png";
            app.CustomTextAttributes.Add("Creator", "Apple Software");
            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");

            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");
            nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });
            nt1.CustomTextAttributes.Add("Language", "English");
            nt1.CustomTextAttributes.Add("Timezone", "PST");

            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2605 Your document was published", @"File 'c:\file.txt' was successfully published at 8:57pm.");
            notification.Sticky = false;
            notification.Priority = Priority.Emergency;
            //notification.Icon = "http://atomicbride.com/Apple.gif";
            app.Icon = @"c:\apple.png";
            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");
            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");
            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));

            string data = "this is my context\nthis is after a line break";
            string type = typeof(string).ToString();
            CallbackContext context = new CallbackContext(data, type);

            Growl.Connector.RequestData rd = new RequestData();
            rd.Add("Return-To-Me", "some text value");
            rd.Add("Return-To-Me2", "another value");

            growl.Notify(notification, context, rd);
            this.textBox1.Text = "NOTIFY sent";
        }
Ejemplo n.º 34
0
        private void button2_Click(object sender, EventArgs e)
        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");
            //app.Icon = "http://atomicbride.com/Apple.gif";
            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";
            app.Icon = @"c:\apple.png";
            app.CustomTextAttributes.Add("Creator", "Apple Software");
            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");

            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");
            //nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });
            nt1.CustomTextAttributes.Add("Language", "English");
            nt1.CustomTextAttributes.Add("Timezone", "PST");

            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2065 Your docu;ment\nwas publi&shed", "File 'c:\\file.txt' was successfully published at 8:57pm.\n\nClick this notification to open the file.\n\nThis is a test of the expanding displays.");
            notification.Sticky = false;
            notification.Priority = Priority.Emergency;
            notification.Icon = "http://atomicbride.com/Apple.gif";
            //notification.Icon = "http://haxe.org/favicon.ico";
            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");
            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");
            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));
            notification.CoalescingID = "secretfaketest";

            //string url = "http://localhost/growl-callback.aspx";
            //string url = "mailto:[email protected]";
            string url = "itpc:http://www.npr.org/rss/podcast.php?id=35";
            CallbackContext callback = new CallbackContext(url);

            Growl.Connector.RequestData rd = new RequestData();
            rd.Add("Return-To-Me", "some text value");
            rd.Add("Return-To-Me2", "this is some longer value, including a \n few \n line \n breaks");
            rd.Add("Can I have spaces?", "dont know");

            growl.Notify(notification, callback, rd);
            this.textBox1.Text = "NOTIFY sent";
        }
 public RequestData GetData()
 {
     var data = new RequestData();
     data.Add(DataKey.Item, "foo-bar");
     return data;
 }
Ejemplo n.º 36
0
        private RequestData GetSitecoreData()
        {
            var data = new RequestData();

            data.Add(DataKey.Request, GetRequest());
            data.Add(DataKey.Diagnostics, GetDiagnostics());
            data.Add(DataKey.PageMode, GetPageMode());
            data.Add(DataKey.Culture, GetCulture());
            data.Add(DataKey.Language, GetLanguage());
            data.Add(DataKey.Domain, GetDomain());
            data.Add(DataKey.Device, GetDevice());
            data.Add(DataKey.User, GetUser());
            data.Add(DataKey.Database, GetDatabase());
            data.Add(DataKey.Site, GetSite());
            data.Add(DataKey.ItemVisualization, GetItemVisualization());
            data.Add(DataKey.ItemTemplate, GetItemTemplate());
            data.Add(DataKey.Item, GetItem());
            data.Add(DataKey.VersionInfo, GetVersionInfo());
            data.Add(DataKey.License, GetLicense());
            data.Add(DataKey.Services, _serviceClients.ToArray());
            data.Add(DataKey.Controllers, _controllers.ToArray());
            data.Add(DataKey.UserList, _users.ToArray());

            return(data);
        }
        private RequestData GetSitecoreData()
        {
            var data = new RequestData();

            data.Add(DataKey.Request, GetRequest());
            data.Add(DataKey.Diagnostics, GetDiagnostics());
            data.Add(DataKey.PageMode, GetPageMode());
            data.Add(DataKey.Culture, GetCulture());
            data.Add(DataKey.Language, GetLanguage());
            data.Add(DataKey.Domain, GetDomain());
            data.Add(DataKey.Device, GetDevice());
            data.Add(DataKey.User, GetUser());
            data.Add(DataKey.Database, GetDatabase());
            data.Add(DataKey.Site, GetSite());
            data.Add(DataKey.ItemVisualization, GetItemVisualization());
            data.Add(DataKey.ItemTemplate, GetItemTemplate());
            data.Add(DataKey.Item, GetItem());
            data.Add(DataKey.VersionInfo, GetVersionInfo());
            data.Add(DataKey.License, GetLicense());
            data.Add(DataKey.Services, _serviceClients.ToArray());
            data.Add(DataKey.Controllers, _controllers.ToArray());
            data.Add(DataKey.UserList, _users.ToArray());

            return data;
        }