コード例 #1
0
        static void Main(string[] args)
        {
            DiamondShape myDiamond = new DiamondShape(9);

            myDiamond.CreateDiamond();

            Console.Write(myDiamond.ToString());
        }
コード例 #2
0
        public void TestDiamondStringCreator()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = "***";
            string actual;

            actual = myDiamond.CreateDiamondsString(3);

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void TestWhiteSpaceStringCreator()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = "  ";
            string actual;

            actual = myDiamond.CreateWhiteSpaceString(2);

            Assert.Equal(expected, actual);
        }
コード例 #4
0
        public void TestCreateRowNumberThreeWithSizeSeven()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(7);
            string expected = " ***** ";
            string actual;

            actual = myDiamond.CreateRow(3);

            Assert.Equal(expected, actual);
        }
コード例 #5
0
        public void TestCreateRow()
        {
            MyDiamond.DiamondShape myDiamond = new MyDiamond.DiamondShape(3);
            string expected = " * ";
            string actual;

            actual = myDiamond.CreateRow(1);

            Assert.Equal(expected, actual);
        }
コード例 #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);
        }
コード例 #7
0
        public void TestConstructorOnlyAcceptUneven()
        {
            bool constructThrewExcept = false;

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

            Assert.True(constructThrewExcept);
        }