예제 #1
0
 public void CanAdvanceFalse()
 {
     var field = new Field( 10, 10 );
     var checker = new Mock<OverlapChecker>();
     checker.Setup( x => x.Check( field, null, 0, 1 ) ).Returns( false );
     field.Checker = checker.Object;
     Assert.AreEqual( false, field.CanAdvance() );
 }
예제 #2
0
        public void Test_CanAdvance_WhenNotAtTheBottom_ReturnsTrue()
        {
            int blockHeight = 3;
            int fieldHeight = 10;

            Field subject = new Field(10, 10);
            subject.SetBlock(new BlockHelper.MockBlock(1, blockHeight), new Vector2(2, fieldHeight - blockHeight - 1));

            Assert.That(subject.CanAdvance(), Is.True);
        }
예제 #3
0
        public void Test_CanAdvance_WhenAtBottom_ReturnsFalse()
        {
            int blockHeight = 3;
            int fieldHeight = 10;

            Field subject = new Field(10, 10);
            subject.SetBlock(new BlockHelper.MockBlock(1, blockHeight), new Vector2(3, fieldHeight - blockHeight));

            Assert.That(subject.CanAdvance(), Is.False);
        }
예제 #4
0
        public void Test_CanAdvance_WhenNotAtTheBottom_ReturnsTrue()
        {
            int blockHeight = 3;
            int fieldHeight = 10;

            Mock<IBlock> block = new Mock<IBlock>();
            block.Setup(b => b.Height).Returns(blockHeight);

            Field subject = new Field(10, 10);
            subject.SetBlock(block.Object, new Vector2(2, fieldHeight - blockHeight - 1));

            Assert.IsTrue(subject.CanAdvance());
        }
예제 #5
0
        public void Test_CanAdvance_WhenNotAtTheBottomButBlockInWay_ReturnsFalse()
        {
            int blockHeight = 3;
            int fieldHeight = 10;

            Field subject = new Field(10, 10);
            subject.SetBlock(new BlockHelper.MockBlock(1, blockHeight), new Vector2(2, fieldHeight - blockHeight - 1));
            subject.SetContentsForTest(new Color?[,]{
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,Color.Red},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null},
                {null,null,null,null,null,null,null,null,null,null}
            });

            Assert.That(subject.CanAdvance(), Is.False);
        }