public void CanAct_DefaultActions_ReturnTrue()
        {
            var subject = new BUnit(1);

            var noop = new NoopAction();

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

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

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

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

            Assert.True(subject.CanAttemptAction(move));
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }