Esempio n. 1
0
        public void CanAct_DefaultActions_ReturnTrue()
        {
            var subject = new BUnit(1);

            var noop = new NoopAction();

            Assert.True(subject.CanAttemptAction(noop));
        }
Esempio n. 2
0
        public void CanAct_Attack_ReturnTrue()
        {
            var subject = new BUnit();

            var attack = new AttackAction(Guid.NewGuid());

            Assert.True(subject.CanAttemptAction(attack));
        }
Esempio n. 3
0
        public void CanAct_Move_ReturnTrue()
        {
            var subject = new BUnit();

            var move = new MoveAction(MoveAction.Direction.EAST);

            Assert.True(subject.CanAttemptAction(move));
        }
Esempio n. 4
0
        public void Take_NonFood_ReturnFalse()
        {
            //Setup
            var subject = new BUnit(0);
            var item    = new Mock <ITransferable>();

            //Act
            var canTake = subject.Take(item.Object);

            //Assert
            Assert.False(canTake);
        }
Esempio n. 5
0
        public void CanTake_SpaceForFood_ReturnTrue()
        {
            //Setup
            var subject = new BUnit(1);
            var action  = new TakeAction(Guid.NewGuid());

            //Act
            var canAct = subject.CanAttemptAction(action);

            //Assert
            Assert.True(canAct);
        }
Esempio n. 6
0
        public void CanGive_FoodNotOwned_ReturnFalse()
        {
            //Setup
            var subject = new BUnit();
            var action  = new GiveAction(Guid.NewGuid(), Guid.NewGuid());

            //Act
            var canAct = subject.CanAttemptAction(action);

            //Assert
            Assert.False(canAct);
        }
Esempio n. 7
0
        public void Drop_NonFood_ReturnFalse()
        {
            //Setup
            var subject = new BUnit(0);
            var item    = new Mock <ITransferable>();

            //Act
            var canDrop = subject.Drop(item.Object);

            //Assert
            Assert.False(canDrop);
        }
Esempio n. 8
0
        public void Take_GatherLimitExceeded_CannotTake()
        {
            //Setup
            var subject  = new BUnit(2);
            var quantity = new Random().Next(5, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);

            //Act
            var canAdd = subject.Take(food);

            //Assert
            Assert.False(canAdd);
            Assert.Equal(0, subject.TotalFoodQuantity);
        }
Esempio n. 9
0
        public void Take_CanAddFood_AddedToFoodSupply()
        {
            //Setup
            var subject  = new BUnit(50);
            var quantity = new Random().Next(1, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);

            //Act
            var canAdd = subject.Take(food);

            //Assert
            Assert.True(canAdd);
            Assert.Equal(quantity, subject.TotalFoodQuantity);
        }
Esempio n. 10
0
        public void Take_AlreadyOwnFood_CannotTakeAndNoChange()
        {
            //Setup
            var subject  = new BUnit(500);
            var quantity = new Random().Next(1, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);

            //Act
            subject.Take(food);
            var canAdd = subject.Take(food);

            //Assert
            Assert.False(canAdd);
            Assert.Equal(quantity, subject.TotalFoodQuantity);
        }
Esempio n. 11
0
        public void CanGive_FoodOwned_ReturnTrue()
        {
            //Setup
            var subject  = new BUnit(50);
            var quantity = new Random().Next(1, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);
            var action   = new GiveAction(food.Id, Guid.NewGuid());

            subject.Take(food);

            //Act
            var canAct = subject.CanAttemptAction(action);

            //Assert
            Assert.True(canAct);
        }
Esempio n. 12
0
        public void Drop_FoodOwned_LessFood()
        {
            //Setup
            var subject  = new BUnit(50);
            var quantity = new Random().Next(1, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);

            subject.Take(food);

            //Act
            var canDrop = subject.Drop(food);

            //Assert
            Assert.True(canDrop);
            Assert.Equal(0, subject.TotalFoodQuantity);
        }
Esempio n. 13
0
        public void Drop_DoNotOwnFood_CannotDrop()
        {
            //Setup
            var subject  = new BUnit(50);
            var quantity = new Random().Next(1, 50);
            var food     = new Food(quantity, Food.FoodQuality.FAIR);
            var altFood  = new Food(quantity + 1, Food.FoodQuality.POOR);

            subject.Take(food);

            //Act
            var canDrop = subject.Drop(altFood);

            //Assert
            Assert.False(canDrop);
            Assert.Equal(quantity, subject.TotalFoodQuantity);
        }