public void DonateToChildren() { var actor = GridCell.New(); actor.Offense = Tag.New("abcd"); actor.Defense = Tag.New("abcd"); actor.Exchange = Tag.New("abcd"); actor.Mating = Tag.New("abcd"); actor.AddRandomResources(actor.Size * 2); var target = GridCell.New(); target.Offense = Tag.New("abcd"); target.Defense = Tag.New("abcd"); target.Exchange = Tag.New("abcd"); target.Mating = Tag.New("abcd"); target.AddRandomResources(target.Size * 2); // Reverse engineer the interaction percentage so that each child gets 2 resources double percentage = 2.0/actor.Size; var interaction = new TestReproductionInteraction(percentage); var children = interaction.Interact(actor, target); // Verify that the actor and target have paid their fees to the children Assert.AreEqual(actor.Size - 2, actor.CurrentResourceCount); Assert.AreEqual(target.Size - 2, target.CurrentResourceCount); Assert.AreEqual(2, children[0].CurrentResourceCount); Assert.AreEqual(2, children[1].CurrentResourceCount); }
public void PayInteractionFee() { var interaction = new TestReproductionInteraction(0); var actor = GridCell.New(TagSize); actor.AddRandomResources(actor.Size*2); var target = GridCell.New(TagSize); target.AddRandomResources(target.Size * 2); var children = interaction.Interact(actor, target); // Verify that the actor and target have paid their fees to the children Assert.AreEqual(actor.Size, actor.CurrentResourceCount); Assert.AreEqual(target.Size, target.CurrentResourceCount); Assert.AreEqual(0, children[0].CurrentResourceCount); Assert.AreEqual(0, children[1].CurrentResourceCount); }