示例#1
0
            public void WhenGameStarts_Tower2AndTower3_AreEmpty()
            {
                const int IRRELEVANT_NUMBER = 1;
                var game = new Game(IRRELEVANT_NUMBER);

                game.Tower2.Disks.Count.Should().Be(0);
                game.Tower3.Disks.Count.Should().Be(0);
            }
示例#2
0
            public void WhenGameStarts_DisksAreInCorrectOrder()
            {
                int numberOfDisks = 4;

                var game = new Game(numberOfDisks);

                game.IsValid.Should().Be(true);
            }
示例#3
0
            public void When_Move1_ThenDiskShouldMoveFromTower1ToTower2()
            {
                var game = new Game(2);

                game.MoveDisk(game.Tower1, game.Tower2);

                game.Tower1.Disks.Count.Should().Be(1);
                game.Tower2.Disks.Count.Should().Be(1);
                game.Tower3.Disks.Count.Should().Be(0);
            }
示例#4
0
            public void When_DistributeDiskOverTowerTwoAndThree_ThenGameIsNotFinished()
            {
                var game = new Game(2);

                game.MoveDisk(game.Tower1, game.Tower2);
                game.MoveDisk(game.Tower1, game.Tower3);

                game.IsValid.Should().Be(true);
                game.IsFinished.Should().Be(false);
            }
示例#5
0
            public void When_MoveDisksOverEachOtherTwice_ThenGameIsFinished()
            {
                // this is a solution for 2 disks
                var game = new Game(2);

                game.MoveDisk(game.Tower1, game.Tower2);
                game.MoveDisk(game.Tower1, game.Tower3);
                game.MoveDisk(game.Tower2, game.Tower3);

                game.Tower1.Disks.Count.Should().Be(0);
                game.Tower2.Disks.Count.Should().Be(0);
                game.Tower3.Disks.Count.Should().Be(2);

                game.IsFinished.Should().Be(true);
            }
示例#6
0
            public void WhenGameStarts_TowerOneHasNDisks()
            {
                int numberOfDisks = 4;

                var game = new Game(numberOfDisks);

                game.Tower1.Disks.Count.Should().Be(numberOfDisks);
            }
示例#7
0
            public void WhenTowerAHasTwoDisks_TowerCShouldHaveTwoDisks()
            {
                var game = new Game(2);

                game.Start();

                game.Tower1.Disks.Count.Should().Be(0);
                game.Tower2.Disks.Count.Should().Be(0);
                game.Tower3.Disks.Count.Should().Be(2);
            }
示例#8
0
            public void WhenTowerAHasThreeDisks_TowerCShouldHaveThreeDisks()
            {
                var game = new Game(3);

                game.Start();

                game.Tower1.Disks.Count.Should().Be(0);
                game.Tower2.Disks.Count.Should().Be(0);
                game.Tower3.Disks.Count.Should().Be(3);

                game.IsFinished.Should().Be(true);
                game.IsValid.Should().Be(true);
            }
示例#9
0
            public void WhenGameStarts_ItShouldMoveDiskFromTower1ToTower3()
            {
                var game = new Game(1);

                game.Start();

                game.Tower1.Disks.Count.Should().Be(0);
                game.Tower2.Disks.Count.Should().Be(0);
                game.Tower3.Disks.Count.Should().Be(1);
            }