コード例 #1
0
        private SnpViewModel MakeSnpViewModel(SnpModel aa, SnpModel bb)
        {
            var snp = new SnpViewModel(aa, bb)
            {
                IsFavourite = _favouritesManager.Get((aa ?? bb).Id)
            };

            snp.PropertyChanged += OnSnpPropertyChanged;
            return(snp);
        }
コード例 #2
0
 private static void AssertSnp(
     SnpModel snp,
     string expectedId,
     Chromosome expectedLocation,
     int expectedPosition,
     string expectedGenotype)
 {
     Assert.Equal(expectedId, snp.Id);
     Assert.Equal(expectedLocation, snp.Location);
     Assert.Equal(expectedPosition, snp.Position);
     Assert.Equal(expectedGenotype, snp.Genotype);
 }
コード例 #3
0
ファイル: SnpViewModel.cs プロジェクト: galpin/mg.gcompare
        /// <summary>
        /// Initializes a new instance of the <see cref="SnpViewModel"/> class.
        /// </summary>
        /// <param name="a">The <see cref="SnpModel"/> that forms the basis of the comparison
        /// (can be <see langword="null"/>).</param>
        /// <param name="b">The <see cref="SnpModel"/> that is compared to <paramref name="b"/>
        /// (can be <see langword="null"/>).</param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="a"/> and <paramref name="b"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="System.ArgumentOutOfRangeException">
        /// Thrown when <paramref name="a"/> and <paramref name="b"/> do not share the same identifier.
        /// </exception>
        public SnpViewModel(SnpModel a, SnpModel b)
        {
            if (a == null && b == null)
            {
                throw new ArgumentNullException("Must specify at least one SnpModel");
            }
            Guard.IsInRange((a == null || b == null) || a.Id == b.Id, nameof(a));

            Id        = a?.Id ?? b?.Id;
            Location  = (a?.Location ?? b?.Location).Value;
            IsSame    = a == null || b == null ? (bool?)null : a.Genotype == b.Genotype;
            Position  = (a?.Position ?? b?.Position).Value;
            GenotypeA = a?.Genotype;
            GenotypeB = b?.Genotype;
        }