예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }