Esempio n. 1
0
        public string GetField(string fieldName)
        {
            if (string.IsNullOrEmpty(fieldName))
            {
                throw new ArgumentException("The field name may not be null or empty.");
            }

            string rtnValue = string.Empty;

            FieldFilterDelegate del = FieldFilterDelegates[fieldName.ToLower()];

            if (del != null)
            {
                //Initialize the field data to empty field data
                FieldFilterData data = new FieldFilterData();

                //Call delegate, all delegates will modify the FieldData string of the
                //FieldFilterData object we are passing in.
                del(fieldName, data);

                //set the return value to the processed value of the FieldFilterData
                rtnValue = data.Value;
            }

            return(rtnValue);
        }
Esempio n. 2
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Value
        ///</summary>
        public void ValueTest()
        {
            FieldFilterData target   = new FieldFilterData(); // TODO: Initialize to an appropriate value
            string          expected = string.Empty;          // TODO: Initialize to an appropriate value
            string          actual;

            target.Value = expected;
            actual       = target.Value;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the value of the field referenced by "String" with all field filters applied
        /// </summary>
        /// <param name="fieldName"></param>
        /// <exception cref="ArgumentException">Thrown when the fieldName field is null or empty.</exception>
        /// <returns></returns>
        public string GetField(string fieldName)
        {
            if (string.IsNullOrEmpty(fieldName))
            {
                // Throws exception if fieldName is null/empty
                throw new ArgumentException("The field name may not be null or empty.");
            }

            string rtnValue = string.Empty;

            // Initialize delegate
            FieldFilterDelegate del = FieldFilterDelegates[fieldName.ToLower()];

            if (del != null)
            {
                // Initialize FieldFilterData to empty
                FieldFilterData data = new FieldFilterData();
                // Call delegate, to modify Field Data string of FieldFilterData object being passed in
                del(fieldName, data);
                // Set return value to processed value of FieldFilterData
                rtnValue = data.Value;
            }
            return(rtnValue);
        }