コード例 #1
0
ファイル: Program.cs プロジェクト: e-hamlett/CSharpFun
 static void AbstractDemo()
 {
     TRex           trex = new TRex();
     Triceratops    tri  = new Triceratops();
     Archaeopteryx  arc  = new Archaeopteryx();
     NarratorLizard nl   = new NarratorLizard();
 }
コード例 #2
0
        public void ArchaeopteryxNotUsed_coolDownRemained_coolDownEqualsZero()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);

            Assert.Equal(0, mockArchaeopteryx.coolDown);
        }
コード例 #3
0
        public void ArchaeopteryxMove_edgeOfLevelAchieved_returnsTheSameTile()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockTile = new MockTile(mockCharacter, 3, 3, 3, 3);

            var destination = mockArchaeopteryx.OnMovement(mockCharacter, mockTile, null, ICreature.direction.NW);

            Assert.Equal(mockTile, destination);
        }
コード例 #4
0
        public void ArchaeopteryxUs_FriendlinessIncreased_AnchiornisMoreAttracted()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockFriendlyAnchiornis = new Anchiornis();
            var mockTile = new MockTile(mockCharacter, 3, 3, 2, 2);

            mockArchaeopteryx.OnUs(mockCharacter, mockFriendlyAnchiornis, mockTile);

            Assert.Equal(12, mockFriendlyAnchiornis.friendliness);
        }
コード例 #5
0
        public void ArchaeopteryxTiles_territoryUnlocked_returnsAccessible()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockTile      = new MockTile(mockCharacter, 3, 3, 2, 2);
            var mockTerritory = new MockHiddenTerritory(mockCharacter, mockArchaeopteryx, mockTile);

            mockArchaeopteryx.OnTile(mockCharacter, mockTerritory);

            Assert.True(mockTerritory.isAccessible);
        }
コード例 #6
0
        public void ArchaeopteryxUsed_coolDownIncreased_coolDownEqualsCoolDownLimit()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockTile      = new MockTile(mockCharacter, 3, 3, 2, 2);
            var mockTerritory = new MockHiddenTerritory(mockCharacter, mockArchaeopteryx, mockTile);

            mockArchaeopteryx.OnTile(mockCharacter, mockTerritory);

            Assert.Equal(mockArchaeopteryx.coolDown, mockArchaeopteryx.coolDownTime);
        }
コード例 #7
0
        public void ArchaeopteryxMove_successfulStart_returnsFinalDestination()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockTile = new MockTile(mockCharacter, 3, 3, 1, 1);

            var destination       = mockArchaeopteryx.OnMovement(mockCharacter, mockTile, null, ICreature.direction.NE) as ITile;
            var xRaised           = destination.X == 3;
            var yRaised           = destination.Y == 3;
            var movementPerformed = xRaised && yRaised;

            Assert.True(movementPerformed);
        }
コード例 #8
0
        public void ArchaeopteryxMove_edgeOfLevelIsMidway_returnsMidway()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockTile = new MockTile(mockCharacter, 3, 3, 2, 2);

            var destination       = mockArchaeopteryx.OnMovement(mockCharacter, mockTile, null, ICreature.direction.NE) as ITile;
            var xRaised           = destination.X == 3;
            var yRaised           = destination.Y == 3;
            var movementPerformed = xRaised && yRaised;

            Assert.True(movementPerformed);
        }
コード例 #9
0
        public void ArchaeopteryxUs_SocialCoefficientIncreased_AnchiornisMoreAttractedThanOther()
        {
            var mockCharacter     = new Character();
            var mockArchaeopteryx = new Archaeopteryx();

            mockCharacter.CreditArchaeopteryx(mockArchaeopteryx);
            var mockFriendlyAnchiornis   = new Anchiornis();
            var mockUnfriendlyAnchiornis = new Anchiornis();

            mockFriendlyAnchiornis.IncreaseFriendliness(15);
            mockUnfriendlyAnchiornis.IncreaseFriendliness(15);
            var mockTile = new MockTile(mockCharacter, 3, 3, 2, 2);

            mockArchaeopteryx.OnUs(mockCharacter, mockFriendlyAnchiornis, mockTile);
            mockUnfriendlyAnchiornis.IncreaseFriendliness(mockCharacter.socialCoefficient);
            var friendlinessIsNotEqual = mockFriendlyAnchiornis.friendliness == mockUnfriendlyAnchiornis.friendliness;

            Assert.False(friendlinessIsNotEqual);
        }
コード例 #10
0
 public void CreditArchaeopteryx(Archaeopteryx archaeopteryx)
 {
     perks = new List <IPerk>();
     perks.Add(archaeopteryx);
     Console.WriteLine(archaeopteryx.ToString());
 }