public void GetNextVariantTests() { var resultVariant = new CalledAllele(); var resultVariants = new List <CalledAllele> { resultVariant }; string resultString = string.Empty; var vr = new AlleleReader(VcfTestFile_1); vr.GetNextVariants(out resultVariants, out resultString); Assert.Equal(resultString.TrimEnd('\r'), @"chr1 10 . A . 25 PASS DP=500 GT:GQ:AD:VF:NL:SB:NC 1/1:25:0,0:0.0000:23:0.0000:0.0010"); Assert.Equal(resultVariants[0].Chromosome, "chr1"); Assert.Equal(resultVariants[0].ReferenceAllele, "A"); Assert.Equal(resultVariants[0].AlternateAllele, "."); //Note, we have seen this assert below fail for specific user configurations //When it fails the error mesg is as below: //Assert.Equal() Failure //Expected: 1428 //Actual: 1452 //If this happens to you, check your git attributes config file. //You might be handling vcf text file line endings differently so the white space counts differently in this test. // In that case, the fail is purely cosmetic. // //try: Auto detect text files and perform LF normalization //# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ //*text = auto //*.cs diff = csharp //*.bam binary //*.vcf text //.fa text eol = crlf if (vr.Position() == 1428) { Console.WriteLine("This isn't critical, but you might want to change your line endings convention. "); Console.WriteLine("This project was developed with \\CR\\LF , not \\LF convention."); } else { Assert.Equal(1452, vr.Position()); } var resultStringArray = new string[] { }; resultVariant = new CalledAllele(); resultVariants = new List <CalledAllele> { resultVariant }; vr.GetNextVariants(out resultVariants, out resultString); Assert.Equal(resultString.TrimEnd('\r'), @"chr1 20 . A T 25 PASS DP=500 GT:GQ:AD:VF:NL:SB:NC 1/1:25:0,0:0.0000:23:0.0000:0.0010"); for (var i = 0; i < resultStringArray.Length; i++) { resultStringArray[i] = resultStringArray[i].TrimEnd('\r'); } Assert.Equal(resultVariants[0].Chromosome, "chr1"); resultVariant = new CalledAllele(); resultVariants = new List <CalledAllele> { resultVariant }; vr.GetNextVariants(out resultVariants); Assert.Equal(resultVariants[0].Chromosome, "chr1"); Assert.Equal(resultVariants[0].ReferenceAllele, "A"); Assert.Equal(resultVariants[0].AlternateAllele, "AT"); }