public void TestAct() { Agent target = new Hacker(); Agent.IsActing = true; Agent.Target = target; Agent.ActIfAble(); Assert.IsTrue(target.WasFramed); Assert.IsTrue(target.Visitors.Contains(Agent.Codename)); target.Reset(); Agent.Reset(); }
public void TestReset() { Agent agent = new Hacker(); Agent protector = new Medic(); Agent blocker = new Saboteur(); Agent framer = new Fabricator(); Agent killer = new Android(); string name = agent.Name; string codename = agent.Codename; Gender gender = agent.Gender; agent.Reset(); Assert.AreEqual(name, agent.Name); Assert.AreEqual(codename, agent.Codename); Assert.AreEqual(gender, agent.Gender); agent.Visit(protector); agent.Reset(); Assert.IsNotNull(agent.Visitors); Assert.AreEqual(0, agent.Visitors.Count); agent.Target = protector; agent.IsActing = true; agent.Reset(); Assert.IsNull(agent.Target); Assert.IsFalse(agent.IsActing); agent.Protect(protector); agent.Reset(); Assert.IsFalse(agent.IsProtected); Assert.IsNull(agent.Protector); agent.Block(blocker); agent.Reset(); Assert.IsFalse(agent.IsBlocked); Assert.IsNull(agent.Blocker); agent.Frame(framer); agent.Reset(); Assert.IsFalse(agent.WasFramed); agent.Attack(killer); agent.Reset(); Assert.IsFalse(agent.WasAttacked); Assert.IsFalse(agent.WasKilled); Assert.IsFalse(agent.IsActive); Assert.IsNotNull(agent.Killer); }
public void TestAttack() { Agent agent = new Hacker(); Agent attacker = new Android(); Agent protector = new Medic(); agent.Protect(protector); agent.Attack(attacker); Assert.IsTrue(agent.WasAttacked); Assert.IsTrue(agent.IsActive); Assert.IsNull(agent.Killer); agent.Reset(); agent.Attack(attacker); Assert.IsTrue(agent.WasAttacked); Assert.IsFalse(agent.IsActive); Assert.IsNotNull(agent.Killer); Assert.AreSame(attacker, agent.Killer); }