コード例 #1
0
ファイル: ActorTests.cs プロジェクト: tznind/Wanderer
        public void TestDecideActor_ConsidersRelationships(bool areFriends)
        {
            var you  = YouInARoom(out IWorld w);
            var them = new Npc("Dave", you.CurrentLocation);

            w.Relationships.Add(new PersonalRelationship(them, you)
            {
                Attitude = areFriends ? 10 : -10
            });

            //Do you want to pick player for something unkind?
            Assert.That(() => them.DecideActor(new[] { you }, -5), areFriends? (IResolveConstraint)Is.Empty : Contains.Item(you));

            //You wouldn't wish this action on your worst enemy!
            Assert.That(() => them.DecideActor(new[] { you }, -500), Is.Empty);

            //Do you want to pick player for something nice?
            Assert.That(() => them.DecideActor(new[] { you }, 5), areFriends? (IResolveConstraint)Contains.Item(you):Is.Empty);

            //You wouldn't want to give him your house though
            Assert.That(() => them.DecideActor(new[] { you }, 500), Is.Empty);
        }