예제 #1
0
        private void InitTextPatterns()
        {
            IPattern pattern = new FirstPattern();

            pattern.Create(5);
            txtPattern1.Text = pattern.Result;
            pattern          = new SecondPattern();
            pattern.Create(5);
            txtPattern2.Text = pattern.Result;
            pattern          = new ThirdPattern();
            pattern.Create(5);
            txtPattern3.Text = pattern.Result;
            pattern          = new FourthPattern();
            pattern.Create(5);
            txtPattern4.Text = pattern.Result;
            pattern          = new FifthPattern();
            pattern.Create(5);
            txtPattern5.Text = pattern.Result;
            pattern          = new SixthPattern();
            pattern.Create(3);
            txtPattern6.Text = pattern.Result;
            pattern          = new SeventhPattern();
            pattern.Create(3);
            txtPattern7.Text = pattern.Result;
        }
        public void CreateTest_ArgException()
        {
            // Arrange
            var pattern = new SeventhPattern();

            // Assert
            pattern.Create(999999);
        }
        public void CreateTest()
        {
            // Arrange
            var          pattern     = new SeventhPattern();
            const string validResult = "*     *      *       *        *         \n      **     **      **       **        \n             ***     ***      ***       \n                     ****     ****      \n                              *****     \n";

            // Act
            pattern.Create(5);

            // Assert
            Assert.AreEqual(pattern.Result, validResult);
        }
        public void CreateFoldedOutputTest()
        {
            // Arrange
            var          pattern     = new SeventhPattern();
            const string validResult = "*     *      *                   *                   \n      **     **                  **                  \n             ***     .  .  .     ***                 \n                                 ****                \n                                 *****               \n                                 ******              \n                                 *******             \n                                 ********            \n                                 *********           \n                                 **********          \n                                 ***********         \n                                 ************        \n                                 *************       \n                                 **************      \n                                 ***************     \n";

            // Act
            pattern.Create(15);
            pattern.CreateFoldedOutput();

            // Assert
            Assert.AreEqual(pattern.FoldedResult, validResult);
        }
예제 #5
0
        public void ApplyPatternTest_Folded()
        {
            // Arrange
            MainWindow     mainWindow = new MainWindow();
            SeventhPattern pattern    = new SeventhPattern();

            // Act
            pattern.Create(20);
            pattern.CreateFoldedOutput();
            mainWindow.ApplyResult(pattern);

            // Assert
            Assert.AreEqual(mainWindow.txtDisplay.Text, pattern.FoldedResult);
        }
예제 #6
0
        public void ApplyPatternTest_ButtonDisable()
        {
            // Arrange
            MainWindow     main    = new MainWindow();
            SeventhPattern pattern = new SeventhPattern();

            pattern.Create(5);
            pattern.CreateFoldedOutput();

            // Act
            main.ApplyResult(pattern);

            // Assert
            Assert.AreEqual(main.btnShowOrHide.Visibility, Visibility.Hidden);
        }