Example #1
0
        public void ConverToCommaSeperatedStringTest()
        {
            CommaSeperatedUtils target = new CommaSeperatedUtils();
            IEnumerable         list   = new List <string>();
            bool   autoQuote           = false;
            string fieldName           = string.Empty;
            string expected            = string.Empty;
            string actual;

            actual = target.ConverToCommaSeperatedString(list, autoQuote);
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void FindFirstElementInIEnumeratorTest2()
        {
            CommaSeperatedUtils target = new CommaSeperatedUtils();
            List <string>       source = new List <string>();

            source.Add("Item1");
            source.Add("Item2");
            object expected = "Item1";
            object actual;

            actual = target.FindFirstElementInIEnumerator(source);
            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void ConverToCommaSeperatedStringTest6()
        {
            CommaSeperatedUtils target = new CommaSeperatedUtils();
            List <int>          list   = new List <int>();

            list.Add(1000);
            list.Add(2000);
            bool   autoQuote = true;
            string expected  = "1000,2000";
            string actual;

            actual = target.ConverToCommaSeperatedString(list, autoQuote);
            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void ConverToCommaSeperatedStringTest2()
        {
            CommaSeperatedUtils target = new CommaSeperatedUtils();
            List <string>       list   = new List <string>();

            list.Add("Item1");
            list.Add("Item2");
            bool   autoQuote = false;
            string fieldName = string.Empty;
            string expected  = "Item1,Item2";
            string actual;

            actual = target.ConverToCommaSeperatedString(list, autoQuote);
            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public void FindFirstElementInIEnumeratorTest()
        {
            CommaSeperatedUtils target = new CommaSeperatedUtils();
            IEnumerable         source = new Dictionary <string, object>();
            object expected            = null;
            object actual;

            try
            {
                actual = target.FindFirstElementInIEnumerator(source);
                Assert.AreEqual(expected, actual);
            }
            catch (DesignByContractException)
            {
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Example #6
0
        public void FindFirstElementInIEnumeratorTest3()
        {
            CommaSeperatedUtils     target = new CommaSeperatedUtils();
            List <ComplexStructure> source = new List <ComplexStructure>();
            ComplexStructure        c1     = new ComplexStructure()
            {
                Field1 = "F1", Field2 = Guid.NewGuid()
            };
            ComplexStructure c2 = new ComplexStructure()
            {
                Field1 = "F1", Field2 = Guid.NewGuid()
            };

            source.Add(c1);
            source.Add(c2);
            object expected = c1;
            object actual;

            actual = target.FindFirstElementInIEnumerator(source);
            Assert.AreEqual(expected, actual);
        }
Example #7
0
        public void ConverToCommaSeperatedStringTest4()
        {
            CommaSeperatedUtils     target = new CommaSeperatedUtils();
            List <ComplexStructure> list   = new List <ComplexStructure>();

            list.Add(new ComplexStructure()
            {
                Field1 = "Item1"
            });
            list.Add(new ComplexStructure()
            {
                Field1 = "Item2"
            });
            bool   autoQuote = true;
            string fieldName = "Field1";
            string expected  = "'Item1','Item2'";
            string actual;

            actual = target.ConverToCommaSeperatedString(list, autoQuote, fieldName);
            Assert.AreEqual(expected, actual);
        }
Example #8
0
        public void ConverToCommaSeperatedStringTest5()
        {
            CommaSeperatedUtils     target = new CommaSeperatedUtils();
            List <ComplexStructure> list   = new List <ComplexStructure>();
            Guid g1 = Guid.NewGuid();
            Guid g2 = Guid.NewGuid();

            list.Add(new ComplexStructure()
            {
                Field1 = "Item1", Field2 = g1
            });
            list.Add(new ComplexStructure()
            {
                Field1 = "Item2", Field2 = g2
            });
            bool   autoQuote = true;
            string fieldName = "Field2";
            string expected  = "'" + g1.ToString() + "','" + g2.ToString() + "'";
            string actual;

            actual = target.ConverToCommaSeperatedString(list, autoQuote, fieldName);
            Assert.AreEqual(expected, actual);
        }
Example #9
0
 public void CommaSeperatedUtilsConstructorTest()
 {
     CommaSeperatedUtils target = new CommaSeperatedUtils();
 }