Пример #1
0
        public void TestDeathDate()
        {
            var dob        = Etx.RandomAdultBirthDate();
            var testResult = AmericanDeathCert.RandomDeathDate(dob, Gender.Female.ToString());

            Assert.AreNotEqual(dob, testResult);
            Console.WriteLine("{0} - {1}", dob, testResult);
        }
Пример #2
0
        public void TestDeathCert()
        {
            var testSubject = new AmericanDeathCert(AmericanDeathCert.MannerOfDeath.Natural, "Julius Ceaser");

            testSubject.DateOfDeath = DateTime.Today;

            var testResult = testSubject.ToData(KindsOfTextCase.Kabab);

            Assert.IsNotNull(testResult);
            Assert.AreNotEqual(0, testResult.Count);
            foreach (var tr in testResult.Keys)
            {
                Console.WriteLine($"{tr}, {testResult[tr]}");
            }
        }
Пример #3
0
        /// <summary>
        /// Generates a <see cref="DeathCert"/> at random based on the given <see cref="p"/>
        /// </summary>
        /// <param name="p"></param>
        /// <param name="nullOnFutureDate">
        /// Switch parameter to have null returned whenever the random date-of-death is
        /// in the future.
        /// </param>
        /// <returns></returns>
        public static DeathCert GetRandomDeathCert(IPerson p, bool nullOnFutureDate = true)
        {
            if (p?.BirthCert == null)
            {
                return(null);
            }

            var deathDate = AmericanDeathCert.RandomDeathDate(p.BirthCert.DateOfBirth, p.Gender.ToString());

            if (nullOnFutureDate && deathDate > DateTime.UtcNow)
            {
                return(null);
            }

            var manner = Etx.RandomPickOne(AmericanData.MannerOfDeathAvgs);

            return(new AmericanDeathCert(manner, String.Join(" ", p.FirstName, p.LastName))
            {
                DateOfDeath = deathDate
            });
        }