public void DereferenceTest() { IEntity father = Entity.GetBuilder(0).SexIs(Sex.male).Build(); IEntity mother = Entity.GetBuilder(0).SexIs(Sex.female).Build(); IPregnancy preg = new Pregnancy(0, mother, father); IPregnantEntity pregEnt = new PregnantEntity(mother, preg); pregEnt.Clear(); Assert.AreEqual(null, pregEnt.Mother); Assert.AreEqual(null, pregEnt.Pregnancy); Assert.AreEqual(null, preg.Mother); Assert.AreEqual(null, preg.Father); }
public void CreateInstanceTest() { IEntity father = Entity.GetBuilder(0).SexIs(Sex.male).Build(); IEntity mother = Entity.GetBuilder(0).SexIs(Sex.female).Build(); IPregnancy preg = new Pregnancy(0, mother, father); Assert.AreEqual(mother, preg.Mother); Assert.AreEqual(father, preg.Father); Assert.AreEqual(0, preg.CopulationDate); }
public void PregnantEntityTest() { IEntity father = Entity.GetBuilder(0).SexIs(Sex.male).Build(); IEntity mother = Entity.GetBuilder(0).SexIs(Sex.female).Build(); IPregnancy preg = new Pregnancy(0, mother, father); IPregnantEntity pregEnt = new PregnantEntity(mother, preg); Assert.AreEqual(mother, pregEnt.Mother); Assert.AreEqual(preg, pregEnt.Pregnancy); }
public void UpdateTest() { long date = 0; IEntity father = Entity.GetBuilder(date).SexIs(Sex.male).Build(); IEntity mother = Entity.GetBuilder(date).SexIs(Sex.female).Build(); IPregnancy preg = new Pregnancy(date, mother, father); IPregnantEntity pregEnt = new PregnantEntity(mother, preg); date = 300; pregEnt.Update(date); Assert.IsTrue(pregEnt.Pregnancy.IsDue); Assert.AreEqual(date / 365, pregEnt.Mother.Age); }
public void IsDueTest() { long date = 0; IEntity father = Entity.GetBuilder(date).SexIs(Sex.male).Build(); IEntity mother = Entity.GetBuilder(date).SexIs(Sex.female).Build(); IPregnancy preg = new Pregnancy(date, mother, father); IPregnantEntity pregEnt = new PregnantEntity(mother, preg); date = 200; pregEnt.Update(date); Assert.IsFalse(pregEnt.Pregnancy.IsDue); date = 271; pregEnt.Update(date); Assert.IsTrue(pregEnt.Pregnancy.IsDue); }