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

            Assert.Throws <ArgumentException>(() => collection.Add(str));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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"
                    });
 }
Ejemplo n.º 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"
     });
 }
Ejemplo n.º 17
0
 static Honeypot()
 {
     InputNames = new HoneypotInputNameCollection();
     CssClassName = "input-imp-long";
     DefaultInputName = "Phone-Data-Home";
 }
Ejemplo n.º 18
0
 static Honeypot()
 {
     InputNames = new HoneypotInputNameCollection();
     CssClassName = "input-imp-long";
 }