Example #1
0
        public void SetSelfRelationshipShouldThrowException()
        {
            Faction faction = new Faction(_factionContainer, "testIdName", "Test Faction");

            try
            {
                faction.ChangeRelationship(faction, 400);
                Assert.Fail();
            } catch (ExceptionSelfRelationship e)
            {
                Debug.LogWarning(e);
                Assert.AreEqual(0, faction.GetRelationship(faction));
            }
        }
Example #2
0
        public void SetFactionRelationshipDeltaShouldWorkMutualUnmutual()
        {
            Faction faction  = new Faction(_factionContainer, "testIdName", "Test Faction");
            Faction faction2 = new Faction(_factionContainer, "testIdName2", "Test Faction2");

            faction.SetMutualRelationship(faction2, 5);
            faction.ChangeMutualRelationship(faction2, 20);

            Assert.AreEqual(25, faction.GetRelationship(faction2));
            Assert.AreEqual(25, faction2.GetRelationship(faction));

            faction.ChangeMutualRelationship(faction2, -30);

            Assert.AreEqual(-5, faction.GetRelationship(faction2));
            Assert.AreEqual(-5, faction2.GetRelationship(faction));

            faction.ChangeRelationship(faction2, 10);


            Assert.AreEqual(5, faction.GetRelationship(faction2));
            Assert.AreEqual(-5, faction2.GetRelationship(faction));
        }