コード例 #1
0
        public void TestCombineGenotype3()
        {
            var rng               = new PredictableRandomNumberGenerator();
            var gt                = new Genotype('C', Dominance.Recessive, Dominance.Recessive, rng);
            var otherGt           = new Genotype('C', Dominance.Dominant, Dominance.Dominant, rng);
            var resultingGenotype = gt.CombineGenotypes(otherGt);

            TestGenotypeCombinationRatio(gt, otherGt, "Cc", 1.0m);
        }
コード例 #2
0
        private static void TestGenotypeCombinationRatio(Genotype gt, Genotype otherGt, string outcome, decimal frequency)
        {
            var list = new List <Genotype>();

            for (int i = 0; i < 1000; i++)
            {
                var resultingGenotype = gt.CombineGenotypes(otherGt);
                list.Add(resultingGenotype);
            }
            decimal actual = list.Count(g => g.ToString() == outcome) / 1000m;

            Assert.AreEqual(frequency, actual);
        }