Esempio n. 1
0
        static void Main(string[] args)
        {
            DiamondShape myDiamond = new DiamondShape(9);

            myDiamond.CreateDiamond();

            Console.Write(myDiamond.ToString());
        }
Esempio n. 2
0
        public void TestDiamondStringCreator()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = "***";
            string actual;

            actual = myDiamond.CreateDiamondsString(3);

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void TestWhiteSpaceStringCreator()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = "  ";
            string actual;

            actual = myDiamond.CreateWhiteSpaceString(2);

            Assert.Equal(expected, actual);
        }
Esempio n. 4
0
        public void TestCreateRowNumberThreeWithSizeSeven()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = " ***** ";
            string actual;

            actual = myDiamond.CreateRow(3);

            Assert.Equal(expected, actual);
        }
Esempio n. 5
0
        public void TestCreateRow()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(3);
            string expected = " * ";
            string actual;

            actual = myDiamond.CreateRow(1);

            Assert.Equal(expected, actual);
        }
Esempio n. 6
0
        public void TestCreateDiamondMethod()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(3);
            string[] expected = { " * ", "***", " * " };
            string[] actual;

            myDiamond.CreateDiamond();
            actual = myDiamond.DiamondRows;

            Assert.Equal(expected, actual);
        }
Esempio n. 7
0
        public void TestConstructorOnlyAcceptUneven()
        {
            bool constructThrewExcept = false;

            try
            {
                MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(2);
            }
            catch (System.Exception)
            {
                constructThrewExcept = true;
            }

            Assert.True(constructThrewExcept);
        }