public void SingleSpaceTest()
        {
            WordCountHelper helper = new WordCountHelper();
            var             text   = new string(helper.CharsToTitleCase("h ello World").ToArray());

            Assert.IsTrue(text == "H Ello World");
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Learn C# in depth!!");
            var products = Product.GetSampleProducts();

            Print(products);
            //products.Sort(new ProductNameComparer());
            //products.Sort(delegate(Product x, Product y)
            //{
            //    return x.Name.CompareTo(y.Name);
            //});
            Console.WriteLine("*****************");

            foreach (var p in products.OrderBy(u => u.Name))
            {
                Console.WriteLine(p);
            }

            Console.WriteLine("*****************");
            foreach (var p in products.Where(p => p.Price >= 10))
            {
                Console.WriteLine(p);
            }

            int?num    = 123;
            int relNum = num.Value;


            // THINKING!!
            WordCountHelper.TestCount();

            //Print(products);
            Console.ReadKey();
        }
        public void FirstObjectCountTest()
        {
            WordCountHelper  helper = new WordCountHelper();
            List <WordCount> actual = helper.WordsCountList("Blue is Blue");

            Assert.IsTrue(actual.Count() == 2);
            Assert.IsTrue(actual[0].Count == 2);
        }
        public void ListsCountTest()
        {
            WordCountHelper   helper   = new WordCountHelper();
            IList <WordCount> expected = new List <WordCount>();

            expected.Add(new WordCount()
            {
                Word = "Taco", Count = 3
            });
            List <WordCount> actual = helper.WordsCountList("Taco Taco taco");

            Assert.AreEqual(expected.Count(), actual.Count());
            Assert.IsTrue(actual[0].Count == 3);
        }