public void QueryStringProvider_GetCleansedQueryStrings_WithNullData_ReturnsNotNull()
        {
            // Arrange
            var mockQueryStringProviderSource = MockProviders.QueryStringImplementation(null);

            var criteria = new QueryStringProvider(mockQueryStringProviderSource.Object);

            // Act
            var results = criteria.GetQueryStrings();

            // Assert
            Assert.IsNotNull(results);
        }
Beispiel #2
0
        /// <summary>
        /// Try and find matching phone manager phone number records using request info i.e. referrer, valid querystring, entry page
        /// </summary>
        /// <returns>A found PhoneNumber</returns>
        private PhoneManagerCampaignDetail FindMatchingPhoneManagerPhoneNumberUsingGatheredRequestInfo()
        {
            var criteriaParameters = new CriteriaParameterHolder()
            {
                CleansedQueryStrings = _querystringProvider.GetQueryStrings(),
                RequestInfo_NotIncludingQueryStrings =
                    new PhoneManagerCampaignDetail()
                {
                    EntryPage = _umbracoProvider.GetCurrentPageId(),
                    Referrer  = _referrerProvider.GetReferrerOrNone(),
                }
            };

            return(new CriteriaProcessor(criteriaParameters, _repository).GetMatchingRecordFromPhoneManager());
        }
        public void QueryStringProvider_GetCleansedQueryStrings_WithDangerousData_ReturnsTrue()
        {
            // Arrange
            var mockQueryStringProviderSource = MockProviders.QueryStringImplementation(new NameValueCollection
            {
                { "dummykey", " 'or 1 = 1'" }
            });

            var criteria = new QueryStringProvider(mockQueryStringProviderSource.Object);

            // Act
            var results = criteria.GetQueryStrings();

            // Assert
            Assert.IsTrue(results.Count == 1);
            Assert.IsTrue(results.GetKey(0) == "dummykey");
            Assert.IsTrue(results.GetValues("dummykey").First() == "or11");
        }
        public void QueryStringProvider_GetCleansedQueryStrings_WithValidData_ReturnsTrue()
        {
            // Arrange
            var mockQueryStringProviderSource = MockProviders.QueryStringImplementation(new NameValueCollection
            {
                { MockConstants.DefaultData.DefaultCampaignQuerystringKey, MockConstants.MockTestPhoneNumberData.CampaignCode }
            });

            var criteria = new QueryStringProvider(mockQueryStringProviderSource.Object);

            // Act
            var results = criteria.GetQueryStrings();

            // Assert
            Assert.IsTrue(results.Count == 1);
            Assert.IsTrue(results.GetKey(0) == MockConstants.DefaultData.DefaultCampaignQuerystringKey);
            Assert.IsTrue(results.GetValues(MockConstants.DefaultData.DefaultCampaignQuerystringKey).Contains(MockConstants.MockTestPhoneNumberData.CampaignCode));
        }