Example #1
0
        public void ForEach()
        {
            string[] someArray = new[] { "the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog" };

            string results = string.Empty;

            foreach (var item in someArray)
            {
                if(item.Contains("o"))
                    results += item + " ";
            }

            results.ShouldBe(_);
        }
Example #2
0
        public void DotEqualsObjects()
        {
            object a = new { foo = "foo" };
            object b = new { foo = "foo" };

            bool areEqual = a.Equals(b);

            areEqual.ShouldBe(_);
        }
Example #3
0
        public void ObjectsNotEqualSign()
        {
            object a = new { foo = "foo" };
            object b = new { foo = "foo" };

            bool areEqual = a != b;

            areEqual.ShouldBe(_);
        }
Example #4
0
        public void EqualSignObjects()
        {
            object a = new { foo = "foo" };
            object b = new { foo = "foo" };

            bool areEqual = a == b;

            areEqual.ShouldBe(_);
        }
Example #5
0
        public void Switch()
        {
            string message = string.Empty;
            string[] someArray = new[] { "the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog" };

            for (int i = 0; i < someArray.Length; i++)
            {
                switch (someArray[i])
                {
                    case "fox" :
                        {
                            message += "hello fox ";
                            break;
                        }
                    case "cat":
                        {
                            message += "hello cat ";
                            break;
                        }
                    case "dog":
                        {
                            message += "hello dog ";
                            break;
                        }
                    default:
                        {
                            message += "-";
                            break;
                        }
                }
            }

            message.ShouldBe(_);
        }