public void TestNumberTileFactoryCreationsWithNextID()
 {
     var factory = new NumberTileFactory();
     var tileWithIdTwo = factory.CreateTile();
     var tileWithIdThree = factory.CreateTile();
     bool result = tileWithIdTwo.Id == (tileWithIdThree.Id - 1);
     Assert.IsTrue(result);
 }
 public void ExpectDoNotCatchExaptionsTestGetHeshCodeMetothdInProxyFrame()
 {
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var expectetFrame = frameDirector.ConstructFrame(5, 5);
     var proxyFrame = new ProxyFrame(expectetFrame);
     var hash = proxyFrame.GetHashCode();
 }
        public void TestCreationsOfNullTile()
        {
            var tileFactory = new NumberTileFactory();
            var nullTile = tileFactory.CreateNullTile();
            const string ExpectLabel = "";
            string actualLabel = nullTile.Label;

            Assert.AreEqual(ExpectLabel, actualLabel);
        }
 public void ExpectTrueEqualsMethodWhithNullIframeTest()
 {
     TileFactory tileFactoryFirst = new NumberTileFactory();
     FrameBuilder frameBuilderFirst = new ClassicPatternFrameBuilder(tileFactoryFirst);
     var frameDirectorFirst = new FrameDirector(frameBuilderFirst);
     var expectetFrameFirst = frameDirectorFirst.ConstructFrame(5, 5);
     IFrame expectetFrameSecond = null;
     bool result = expectetFrameFirst.Equals(expectetFrameSecond);
     Assert.IsFalse(result);
 }
 public void TestToStringMetothdInProxyFrameDoNotHandleExeptions()
 {
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var expectetFrame = frameDirector.ConstructFrame(5, 5);
     var proxyFrame = new ProxyFrame(expectetFrame);
     string expectedresult = "-----------------\r\n|  1  2  3  4  5|\r\n|  6  7  8  9 10|\r\n| 11 12 13 14 15|\r\n| 16 17 18 19 20|\r\n| 21 22 23 24   |\r\n-----------------";
     string actualsresult = proxyFrame.ToString();
     Assert.AreEqual(expectedresult, actualsresult);
 }
 public void TestMoverIsMovingATileWhichCanBeMovedDownAllColumnRowColMover()
 {
     var mover = new RowColMover();
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var initialFrame = frameDirector.ConstructFrame(4, 4);
     var actualFrame = initialFrame.Clone();
     bool moveDown = mover.Move("4", actualFrame);
     Assert.IsTrue(moveDown, "Mover method should return true when the tile can be moved");
     Assert.AreNotEqual(initialFrame, actualFrame, "The frame should be changed when the mover moves the tile");
 }
 public void ExpectDoNotCatchExaptionsTestEqualsMethodtInProxyFrame()
 {
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var expectetFrame = frameDirector.ConstructFrame(5, 5);
     var proxyFrame = new ProxyFrame(expectetFrame);
     var proxyOne = new ProxyFrame(proxyFrame);
     var proxyTwo = proxyOne;
     var result = proxyOne.Equals(proxyTwo);
     Assert.IsTrue(result);
 }
 public void TestMoverNotMovingATileWhichCanNotBeMoved()
 {
     var mover = new ClassicMover();
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var initialFrame = frameDirector.ConstructFrame(4, 4);
     var actualFrame = initialFrame.Clone();
     bool result = mover.Move("14", actualFrame);
     Assert.IsFalse(result, "Mover method should return false when the tile can not be moved");
     Assert.AreEqual(initialFrame, actualFrame, "The frame should not be changed");
 }
 public void ExpectFalseEqualsMethodWhithDiferentIframeWithDiferentSizeOfColumnsTest()
 {
     TileFactory tileFactoryFirst = new NumberTileFactory();
     TileFactory tileFactorySecond = new NumberTileFactory();
     FrameBuilder frameBuilderFirst = new ClassicPatternFrameBuilder(tileFactoryFirst);
     FrameBuilder frameBuilderSecond = new ColumnsPatternFrameBuilder(tileFactorySecond);
     var frameDirectorFirst = new FrameDirector(frameBuilderFirst);
     var frameDirectorSecond = new FrameDirector(frameBuilderSecond);
     var expectetFrameFirst = frameDirectorFirst.ConstructFrame(5, 5);
     var expectetFrameSecond = frameDirectorSecond.ConstructFrame(6, 6);
     bool result = expectetFrameFirst.Equals(expectetFrameSecond);
     Assert.IsFalse(result);
 }
 public void TestNumberTileFactoryCreations()
 {
     var factory = new NumberTileFactory();
     var numberTile = factory.CreateTile();
     Assert.IsInstanceOfType(numberTile, typeof(ITile));
 }
 public void TestShuffleIsMovingATileWhichCanBeMovedByColumnRowColMover()
 {
     var mover = new RowColMover();
     TileFactory tileFactory = new NumberTileFactory();
     FrameBuilder frameBuilder = new ClassicPatternFrameBuilder(tileFactory);
     var frameDirector = new FrameDirector(frameBuilder);
     var initialFrame = frameDirector.ConstructFrame(4, 4);
     var actualFrame = initialFrame.Clone();
     mover.Shuffle(actualFrame);
     Assert.AreNotEqual(initialFrame, actualFrame, "The frame should be changed when shuffled");
 }