Example #1
0
 static Honeypot()
 {
     SetDefaults();
     InputNames = new HoneypotInputNameCollection();
     Worker = new HoneypotWorker();
     CustomRules = new HoneypotRuleCollection();
 }
Example #2
0
        public void Add_ShouldThorwArgumentException_WhenPassedEmptyString()
        {
            string str        = string.Empty;
            var    collection = new HoneypotInputNameCollection();

            Assert.Throws <ArgumentException>(() => collection.Add(str));
        }
Example #3
0
        public static void RegisterHoneypotInputNames(HoneypotInputNameCollection collection)
        {
            //Honeypot will use 2 words at random to create the input name {0}-{1}
            collection.Add(new[]
            {
                "User",
                "Name",
                "Age",
                "Question",
                "List",
                "Why",
                "Type",
                "Phone",
                "Fax",
                "Custom",
                "Relationship",
                "Friend",
                "Pet",
                "Reason"
            });

            //This is optional, if you don't want the honeypot input to generate a random input name per request
            //You can skip adding any items to the collection and set a DefaultInputName (default: Phone-Data-Home)

            //Honeypot.SetDefaultInputName("NewDefaultInputName");
        }
        public void Remove_ShouldThorwArgumentException_WhenPassedEmptyString()
        {
            string str = string.Empty;
            var collection = new HoneypotInputNameCollection();

            Assert.Throws<ArgumentException>(() => collection.Remove(str));
        }
        public void Add_ShouldThorwArgumentException_WhenPassedNull()
        {
            string str = null;
            var collection = new HoneypotInputNameCollection();

            Assert.Throws<ArgumentException>(() => collection.Add(str));
        }
Example #6
0
        public void Remove_ShouldThorwArgumentException_WhenPassedNull()
        {
            string str        = null;
            var    collection = new HoneypotInputNameCollection();

            Assert.Throws <ArgumentException>(() => collection.Remove(str));
        }
        public void Add_ShouldAddAllStringsInCollection_WhenPassedAnyInitializedIEnumerableOfString()
        {
            var arr = new[] {"Mock 1", "Mock 2", "Mock 3"};
            var collection = new HoneypotInputNameCollection();

            collection.Add(arr);

            Assert.Equal(3, collection.Count);
        }
Example #8
0
        public void Add_ShouldAddAllStringsInCollection_WhenPassedAnyInitializedIEnumerableOfString()
        {
            var arr        = new[] { "Mock 1", "Mock 2", "Mock 3" };
            var collection = new HoneypotInputNameCollection();

            collection.Add(arr);

            Assert.Equal(3, collection.Count);
        }
        public void Remove_ShouldRemoveGivenStringFromCollection_WhenPassedAValidString()
        {
            string str = "Mock String";
            var collection = new HoneypotInputNameCollection();

            collection.Add(str);
            Assert.Equal(1, collection.Count);

            collection.Remove(str);
            Assert.Equal(0, collection.Count);
        }
        public void Clear_ShouldRemoveAllEntriesInCollection()
        {
            var arr = new[] {"Mock 1", "Mock 2", "Mock 3"};
            var collection = new HoneypotInputNameCollection();

            collection.Add(arr);
            Assert.Equal(3, collection.Count);

            collection.Clear();
            Assert.Equal(0, collection.Count);
        }
        public void Add_WillPlaceStringInCollection_WhenPassedAValidString()
        {
            string str = "Mock String";
            var collection = new HoneypotInputNameCollection();

            collection.Add(str);

            string filterName = collection.First();
            Assert.Equal(1, collection.Count);
            Assert.Equal(str, filterName);
        }
Example #12
0
        public void Clear_ShouldRemoveAllEntriesInCollection()
        {
            var arr        = new[] { "Mock 1", "Mock 2", "Mock 3" };
            var collection = new HoneypotInputNameCollection();

            collection.Add(arr);
            Assert.Equal(3, collection.Count);

            collection.Clear();
            Assert.Equal(0, collection.Count);
        }
Example #13
0
        public void Remove_ShouldRemoveGivenStringFromCollection_WhenPassedAValidString()
        {
            string str        = "Mock String";
            var    collection = new HoneypotInputNameCollection();

            collection.Add(str);
            Assert.Equal(1, collection.Count);

            collection.Remove(str);
            Assert.Equal(0, collection.Count);
        }
Example #14
0
        public void Add_WillPlaceStringInCollection_WhenPassedAValidString()
        {
            string str        = "Mock String";
            var    collection = new HoneypotInputNameCollection();

            collection.Add(str);

            string filterName = collection.First();

            Assert.Equal(1, collection.Count);
            Assert.Equal(str, filterName);
        }
Example #15
0
 public static void RegisterHoneypotInputNames(HoneypotInputNameCollection collection)
 {
     //Honeypot will use 2 words to create the input name {0}-{1}
     collection.Add(new[]
                    {
                        "User",
                        "Name",
                        "Age",
                        "Question",
                        "List",
                        "Why",
                        "Type",
                        "Phone",
                        "Fax",
                        "Custom",
                        "Relationship",
                        "Friend",
                        "Pet",
                        "Reason"
                    });
 }
Example #16
0
 public static void RegisterHoneypotInputNames(HoneypotInputNameCollection collection)
 {
     //Honeypot will use 2 words to create the input name {0}-{1}
     collection.Add(new[]
     {
         "User",
         "Name",
         "Age",
         "Question",
         "List",
         "Why",
         "Type",
         "Phone",
         "Fax",
         "Custom",
         "Relationship",
         "Friend",
         "Pet",
         "Reason"
     });
 }
Example #17
0
 static Honeypot()
 {
     InputNames = new HoneypotInputNameCollection();
     CssClassName = "input-imp-long";
     DefaultInputName = "Phone-Data-Home";
 }
Example #18
0
 static Honeypot()
 {
     InputNames = new HoneypotInputNameCollection();
     CssClassName = "input-imp-long";
 }