示例#1
0
        public void CreateIdenticalSizePuzzlesTest()
        {
            PuzzlesStrategyFactoryMethod puzzlesStrategy          = new PuzzlesStrategyFactoryMethod(pictureBox.Image);
            IPuzzlesStrategy             identicalPuzzlesStrategy = puzzlesStrategy.GetStrategy(PuzzlesConfigurations.StrategyTypeEnum.Identical);
            List <Puzzle> puzzles = identicalPuzzlesStrategy.ExtractPuzzles();

            Assert.AreEqual(puzzles[0].Width, puzzles[1].Width);
        }
示例#2
0
        public void CreateDifferentSizePuzzlesTest()
        {
            PuzzlesStrategyFactoryMethod puzzlesStrategy          = new PuzzlesStrategyFactoryMethod(pictureBox.Image);
            IPuzzlesStrategy             differentPuzzlesStrategy = puzzlesStrategy.GetStrategy(PuzzlesConfigurations.StrategyTypeEnum.Different);
            List <Puzzle> puzzles = differentPuzzlesStrategy.ExtractPuzzles();

            foreach (Puzzle puzzle in puzzles)
            {
                if (puzzle.Width != puzzles[0].Width)
                {
                    Assert.AreNotEqual(puzzle.Width, puzzles[0].Width);
                }
            }
        }
示例#3
0
        public void Start()
        {
            PuzzlesStrategyFactoryMethod puzzlesStrategy         = new PuzzlesStrategyFactoryMethod(_pictureBox.Image);
            IPuzzlesStrategy             differentPuzzleStrategy = puzzlesStrategy.GetStrategy(PuzzlesConfigurations.StrategyTypeEnum.Different);
            List <Puzzle>  puzzlesList        = differentPuzzleStrategy.ExtractPuzzles();
            SetPuzzleImage setImagesToPuzzles = new SetPuzzleImage(_pictureBox);

            puzzlesList = setImagesToPuzzles.SetImage(puzzlesList);
            SetConjunctionBetweenPuzzles setConnection = new SetConjunctionBetweenPuzzles(puzzlesList, _form, _pictureBox);

            setConnection.SetConnection();
            basicPictureLocationList = puzzlesList.Clone <Puzzle>().ToList();
            ThrowPuzzlesOnDesk throwPuzzles = new ThrowPuzzlesOnDesk(_form, _pictureBox);

            mixedPictureLocationList = throwPuzzles.Throw(puzzlesList);
            eventHandlers            = new PuzzleEventHandlers(_form, basicPictureLocationList, mixedPictureLocationList);
            eventHandlers.SetHandlers(_pictureBox);
        }