public void TrackAffectedGenes() { var taProvider = new Mock <IAnnotationProvider>(); taProvider.SetupGet(x => x.GenomeAssembly).Returns(GenomeAssembly.GRCh37); taProvider.Setup(x => x.Annotate(It.IsAny <IAnnotatedPosition>())).Callback((IAnnotatedPosition x) => { });//do nothing var geneAnnotationProvider = new Mock <IGeneAnnotationProvider>(); geneAnnotationProvider.SetupGet(x => x.GenomeAssembly).Returns(GenomeAssembly.GRCh37); var annotator = new Annotator(taProvider.Object, null, null, null, geneAnnotationProvider.Object); var annotatedPosition = new Mock <IAnnotatedPosition>(); var annotatedVariant = new Mock <IAnnotatedVariant>(); var ensembleTranscript = new Mock <IAnnotatedTranscript>(); annotatedVariant.SetupGet(x => x.EnsemblTranscripts) .Returns(new List <IAnnotatedTranscript> { ensembleTranscript.Object }); ensembleTranscript.SetupGet(x => x.Transcript.Gene.Symbol).Returns("ensembl1"); var refSeqTranscript = new Mock <IAnnotatedTranscript>(); annotatedVariant.SetupGet(x => x.RefSeqTranscripts) .Returns(new List <IAnnotatedTranscript> { refSeqTranscript.Object }); refSeqTranscript.SetupGet(x => x.Transcript.Gene.Symbol).Returns("refseq1"); annotatedPosition.SetupGet(x => x.AnnotatedVariants).Returns(new[] { annotatedVariant.Object }); annotator.TrackAffectedGenes(annotatedPosition.Object); var geneAnnotation = new Mock <IAnnotatedGene>(); geneAnnotationProvider.Setup(x => x.Annotate("ensembl1")).Returns(geneAnnotation.Object); geneAnnotationProvider.Setup(x => x.Annotate("refseq1")).Returns((IAnnotatedGene)null); var annotatedGenes = annotator.GetAnnotatedGenes(); Assert.Equal(1, annotatedGenes.Count); }