public void Test_ToChar() { String s1 = "100"; String s2 = "10021"; String s3 = "201341"; String s4 = "201442"; String s5 = "3015"; String s6 = "400"; String s7 = "40021"; String s8 = "501341"; String s9 = "501442"; String s10 = "6015"; String s11 = "700"; String s12 = "70021"; String s13 = "801341"; String s14 = "801442"; String s15 = "9015"; String s16 = "9016"; String[] sorted = new String[16] { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16 }; String[] unsorted = new String[16] { s8, s5, s9, s15, s3, s4, s13, s1, s11, s2, s7, s16, s10, s12, s14, s6 }; MostSignificantDigitFirstSort.Sort(unsorted, Alphabet.Decimal); AssertUtilities.Sequence(sorted, unsorted); }
public async Task TestGetAllAsync() { var expected = new CustomerGetAllResponse { Records = new List <CustomerGetAllRecordResponse> { new CustomerGetAllRecordResponse { Id = 1, UserName = "******", FirstName = "John", LastName = "Smith", CreatedDateTime = new DateTime(2019, 1, 1, 8, 20, 36), ModifiedDateTime = new DateTime(2019, 1, 2, 9, 30, 42), }, new CustomerGetAllRecordResponse { Id = 2, UserName = "******", FirstName = "Mary", LastName = "McDonald", CreatedDateTime = new DateTime(2018, 7, 4, 14, 40, 12), ModifiedDateTime = new DateTime(2018, 9, 8, 18, 50, 18), } } }; var actual = await Fixture.Customers.GetAllAsync(); Assert.Equal(HttpStatusCode.OK, actual.StatusCode); AssertUtilities.Equal(expected, actual.Data); }
public async Task RelistProduct_ValidRequest_ReturnsResponse() { var record = _productRecords.Where(e => !e.IsListed).First(); var id = record.Id; var activateRequest = new RelistProductRequest { Id = id, }; var activateResponse = await Fixture.Products.RelistProductAsync(activateRequest); AssertUtilities.NotEmpty(activateResponse.Id); Assert.Equal(record.Id, activateResponse.Id); Assert.Equal(record.ProductCode, activateResponse.Code); Assert.Equal(record.ProductName, activateResponse.Description); Assert.Equal(record.ListPrice, activateResponse.UnitPrice); Assert.True(activateResponse.IsListed); var findRequest = new FindProductRequest { Id = activateResponse.Id }; var findResponse = await Fixture.Products.FindProductAsync(findRequest); Assert.Equal(activateResponse.Id, findResponse.Id); Assert.Equal(activateResponse.Code, findResponse.Code); Assert.Equal(activateResponse.Description, findResponse.Description); Assert.Equal(activateResponse.UnitPrice, findResponse.UnitPrice); Assert.Equal(activateResponse.IsListed, findResponse.IsListed); }
public async Task CreateProduct_ValidRequest_ReturnsResponse() { var createRequest = new CreateProductRequest { Code = "ABC", Description = "My desc", UnitPrice = 123.56m, }; var createResponse = await Fixture.Products.CreateProductAsync(createRequest); AssertUtilities.NotEmpty(createResponse.Id); Assert.Equal(createRequest.Code, createResponse.Code); Assert.Equal(createRequest.Description, createResponse.Description); Assert.Equal(createRequest.UnitPrice, createResponse.UnitPrice); Assert.True(createResponse.IsListed); var findRequest = new FindProductRequest { Id = createResponse.Id }; var findResponse = await Fixture.Products.FindProductAsync(findRequest); Assert.Equal(findRequest.Id, findResponse.Id); Assert.Equal(createRequest.Code, findResponse.Code); Assert.Equal(createRequest.Description, findResponse.Description); Assert.Equal(createRequest.UnitPrice, findResponse.UnitPrice); Assert.True(findResponse.IsListed); }
public async Task UnlistProduct_ValidRequest_ReturnsResponse() { var record = _productRecords.Where(e => e.IsListed).First(); var id = record.Id; var dectivateRequest = new UnlistProductRequest { Id = id, }; var deactivateResponse = await Fixture.Products.UnlistProductAsync(dectivateRequest); AssertUtilities.NotEmpty(deactivateResponse.Id); Assert.Equal(record.Id, deactivateResponse.Id); Assert.Equal(record.ProductCode, deactivateResponse.Code); Assert.Equal(record.ProductName, deactivateResponse.Description); Assert.Equal(record.ListPrice, deactivateResponse.UnitPrice); Assert.False(deactivateResponse.IsActive); var findRequest = new FindProductRequest { Id = deactivateResponse.Id }; var findResponse = await Fixture.Products.FindProductAsync(findRequest); Assert.Equal(deactivateResponse.Id, findResponse.Id); Assert.Equal(deactivateResponse.Code, findResponse.Code); Assert.Equal(deactivateResponse.Description, findResponse.Description); Assert.Equal(deactivateResponse.UnitPrice, findResponse.UnitPrice); Assert.Equal(deactivateResponse.IsActive, findResponse.IsListed); }
public async Task TestGetCollectionAsync() { var actual = await JsonPlaceholderClient.Posts.GetAsync(); Assert.Equal(HttpStatusCode.OK, actual.StatusCode); var expectedCount = 100; var actualCount = actual.Data.Count(); Assert.Equal(expectedCount, actualCount); var expectedFirst = new PostDto { Id = 1, UserId = 1, Title = "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", Body = "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto", }; var actualFirst = actual.Data.First(); AssertUtilities.Equal(expectedFirst, actualFirst); var expectedLast = new PostDto { Id = 100, UserId = 10, Title = "at nam consequatur ea labore ea harum", Body = "cupiditate quo est a modi nesciunt soluta\nipsa voluptas error itaque dicta in\nautem qui minus magnam et distinctio eum\naccusamus ratione error aut", }; var actualLast = actual.Data.Last(); AssertUtilities.Equal(expectedLast, actualLast); }
public void ShouldReturnAccessableWritableLeaves(List <string> writableFolders, List <string> readableFolders, List <string> resultShouldContain) { var result = FolderStructureUtilities.GetWritableFolderStructure(readableFolders, writableFolders); var resultFolders = result.GetLeafFolders(); AssertUtilities.CollectionContainsSubcollection(resultFolders, resultShouldContain); }
public void ShouldNotReturnReadOnlyLeaves(List <string> writableFolders, List <string> readableFolders, List <string> resultShouldNotContain) { var result = FolderStructureUtilities.GetWritableFolderStructure(readableFolders, writableFolders); var resultFolders = result.GetLeafFolders(); AssertUtilities.CollectionDoesNotContainSubcollection(resultFolders, resultShouldNotContain); }
public void IntergenicVariant() { var sa = new SupplementaryAnnotationPosition(47960) { IsRefMinorAllele = true, GlobalMajorAllele = "A", GlobalMajorAlleleFrequency = "0.9239" }; var saReader = new MockSupplementaryAnnotationReader(sa); var annotatedVariant = DataUtilities.GetVariant(Resources.CacheGRCh37("ENST00000518655_chr1_Ensembl84"), saReader, "chr1 47960 . T . 1242.00 PASS SNVSB=-87.0;SNVHPOL=3"); Assert.NotNull(annotatedVariant); Assert.Contains("\"isReferenceMinorAllele\":true", annotatedVariant.ToString()); var altAllele = annotatedVariant.AnnotatedAlternateAlleles.FirstOrDefault(); Assert.NotNull(altAllele); // intergenic variant are not exposed in the JSON file AssertUtilities.CheckEnsemblTranscriptCount(0, altAllele); AssertUtilities.CheckRefSeqTranscriptCount(0, altAllele); }
public void Test_ToChar() { String s1 = "100"; String s2 = "10021"; String s3 = "201341"; String s4 = "201442"; String s5 = "3015"; String s6 = "400"; String s7 = "40021"; String s8 = "501341"; String s9 = "501442"; String s10 = "6015"; String s11 = "700"; String s12 = "70021"; String s13 = "801341"; String s14 = "801442"; String s15 = "9015"; String s16 = "9016"; String[] sorted = new String[16] { s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16 }; String[] unsorted = new String[16] { s8, s5, s9, s15, s3, s4, s13, s1, s11, s2, s7, s16, s10, s12, s14, s6 }; QuickSort3WaySort.Sort(unsorted); AssertUtilities.Sequence(sorted, unsorted); }
public async Task ListProducts_Valid_OK() { var listRequest = new ListProductRequest { }; var actual = await Fixture.Api.Products.ListProductsAsync(listRequest); Assert.Equal(HttpStatusCode.OK, actual.StatusCode); var actualContent = actual.Data; Assert.Equal(2, actualContent.Records.Count); var expectedFirst = _productRecords[0]; var actualFirst = actualContent.Records[0]; AssertUtilities.NotEmpty(actualFirst.Id); Assert.Equal($"{expectedFirst.ProductCode} - {expectedFirst.ProductName}", actualFirst.Name); var expectedSecond = _productRecords[1]; var actualSecond = actualContent.Records[1]; AssertUtilities.NotEmpty(actualSecond.Id); Assert.Equal($"{expectedSecond.ProductCode} - {expectedSecond.ProductName}", actualSecond.Name); }
public async Task ListCustomers_OK() { var listRequest = new ListCustomersRequest { }; var actual = await Fixture.Api.Customers.ListCustomersAsync(listRequest); Assert.Equal(HttpStatusCode.OK, actual.StatusCode); var actualContent = actual.Data; Assert.Equal(2, actualContent.Records.Count); var expectedFirst = _customerRecords[0]; var actualFirst = actualContent.Records[0]; AssertUtilities.NotEmpty(actualFirst.Id); Assert.Equal(expectedFirst.FirstName + " " + expectedFirst.LastName, actualFirst.Name); var expectedSecond = _customerRecords[1]; var actualSecond = actualContent.Records[1]; AssertUtilities.NotEmpty(actualSecond.Id); Assert.Equal(expectedSecond.FirstName + " " + expectedSecond.LastName, actualSecond.Name); }
public async Task TestGetExportsCsvAsync() { var csvSerializationService = new CsvSerializer(); var expectedDtos = new List <CustomerExportGetCollectionResponse> { new CustomerExportGetCollectionResponse { Id = 1, UserName = "******", FirstName = "John", LastName = "Smith", }, new CustomerExportGetCollectionResponse { Id = 2, UserName = "******", FirstName = "Mary", LastName = "McDonald", } }; var expected = csvSerializationService.Serialize(expectedDtos); var actual = await Fixture.Customers.GetCsvExportsAsync(); Assert.Equal(HttpStatusCode.OK, actual.StatusCode); AssertUtilities.Equal(expected, actual.ContentString); }
public async Task CreateCustomer_Valid_Created() { var createRequest = new CreateCustomerRequest { FirstName = "First name 1", LastName = "Last name 1", }; var createResponse = await Fixture.Api.Customers.CreateCustomerAsync(createRequest); Assert.Equal(HttpStatusCode.Created, createResponse.StatusCode); var createResponseContent = createResponse.Data; AssertUtilities.NotEmpty(createResponseContent.Id); Assert.Equal(createRequest.FirstName, createResponseContent.FirstName); Assert.Equal(createRequest.LastName, createResponseContent.LastName); var findRequest = new FindCustomerRequest { Id = createResponseContent.Id }; var findResponse = await Fixture.Api.Customers.FindCustomerAsync(findRequest); Assert.Equal(HttpStatusCode.OK, findResponse.StatusCode); var findResponseContent = findResponse.Data; Assert.Equal(createResponseContent.Id, findResponseContent.Id); Assert.Equal(createRequest.FirstName, findResponseContent.FirstName); Assert.Equal(createRequest.LastName, findResponseContent.LastName); }
public void MultiAlleleProteinAlteringVariant() { // GGGACTGGA|protein_altering_variant|MODIFIER||91544|Transcript|NM_183008.2|protein_coding|16/16||NM_183008.2:c.1501_1533delinsTCCAGTCCC|NP_892120.2:p.Pro501_Pro509delinsSer|1774-1806|1501-1533|501-511|PSPGPGPGPSP/SSP|CCCAGTCCCGGTCCCGGTCCCGGCCCCAGTCCC/TCCAGTCCC|||-1|||YES||NP_892120.2|rseq_mrna_match&rseq_ens_match_cds|||||||| var annotatedVariant = DataUtilities.GetVariant(Resources.CacheGRCh37("NM_183008_chr1_RefSeq84"), "chr1\t26608819\t.\tAGGGACTGGGGCCGGGACCGGGACCGGGACTGGG\tAGGGACTGGG,AGGGACTGGA\t60\tPASS\tCIGAR=1M24D9M,9M25D1I;RU=.,.;REFREP=3,.;IDREP=2,.;GMAF=A|0.3934;cosmic=COSM3749046;CSQT=1|CEP85|NM_022778.3|downstream_gene_variant,2|CEP85|NM_022778.3|downstream_gene_variant,1|SH3BGRL3|NM_031286.3|downstream_gene_variant,2|SH3BGRL3|NM_031286.3|downstream_gene_variant,1|UBXN11|NM_183008.2|inframe_deletion,2|UBXN11|NM_183008.2|\tGT:GQ:GQX:DPI:AD\t1/2:143:119:23:0,3,3"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckAlleleCount(2, annotatedVariant); var altAllele = annotatedVariant.AnnotatedAlternateAlleles.ElementAt(1); Assert.NotNull(altAllele); AssertUtilities.CheckRefSeqTranscriptCount(1, altAllele); var transcript = altAllele.RefSeqTranscripts.FirstOrDefault(); Assert.NotNull(transcript); // ReSharper disable once PossibleNullReferenceException var observedConsequence = string.Join("&", transcript.Consequence); const string expectedConsequence = "protein_altering_variant"; Assert.Equal(expectedConsequence, observedConsequence); }
public void MantaInsertionRsId() { var annotatedVariant = DataUtilities.GetVariant(DataUtilities.EmptyCachePrefix, Resources.MiniSuppAnnotGRCh38("chr1_186774064_186774065.nsa"), "chr1 186774064 MantaINS:338:0:0:0:0:0 C CTATATATATACTTTATATATACTGTATGTGTATATATAAAGTATATATATAGTG 101 MinGQ END=186774064;SVTYPE=INS;SVLEN=54;CIGAR=1M54I;CIPOS=0,8;HOMLEN=8;HOMSEQ=TATATATA GT:FT:GQ:PL:PR:SR 0/0:MinGQ:4:48,3,0:0,0:0,1 0/0:MinGQ:3:50,3,0:0,0:0,1 1/1:MinGQ:7:148,9,0:0,0:0,3"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonContains("rs57376790", annotatedVariant); }
public void Test_Path_Iteration() { BreadthFirstSearch bfs = this.CreateBFS(); AssertUtilities.Sequence(new Int32[2] { 5, 3 }, bfs.PathFromSourceTo(3)); }
public void BreakEnd() { var annotatedVariant = DataUtilities.GetVariant(DataUtilities.EmptyCachePrefix, null, "chr2 13394888 MantaBND:543:0:1:0:0:0:0 G G]chr15:20404341] 114 MaxDepth SVTYPE=BND;MATEID=MantaBND:543:0:1:0:0:0:1;CIPOS=0,3;HOMLEN=3;HOMSEQ=AGT;BND_DEPTH=10;MATE_BND_DEPTH=7 GT:FT:GQ:PL:PR:SR 0/1:PASS:83:133,0,93:2,0:1,3 0/1:PASS:30:80,0,68:3,2:0,3 0/0:MinGQ:11:40,0,153:2,0:2,1"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonContains("\"altAlleles\":[\"G]chr15:20404341]\"]", annotatedVariant); }
public void IndelVariantType() { var annotatedVariant = DataUtilities.GetVariant(DataUtilities.EmptyCachePrefix, null, "chr1 23259022 MantaDEL:58:0:1:0:0:0 GAGGATCACTTGAGCCCAGGAGTTCCAGACCAGCCCGGGCAACATGGTGAAACCCCACCTCTACAAAAAATACAAAAGTTACCCAGGCATGGTGGCACATGCCTATAGTCCCAGCTGCTGGGAGGGTTGAGGTGGGAGGATCACTTGAGCCAGGGAGGTGGAGACTGCAGTGAGCCATGATCACACCACTGCATTCAAGCCTAGGCTGCAACCTCGAGATTTTTTTTTTTTTTGAGATCCTGTCTCAAAAAAAATTTTTTTTGGCCAGGTGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCTGAGGCGGGC GT 95 PASS END=23259340;SVTYPE=DEL;SVLEN=-318;CIGAR=1M1I318D GT:FT:GQ:PL:PR:SR 0/0:PASS:50:0,1,2:1,0:0,0 1/1:MinGQ:7:147,9,0:0,0:1,3 0/0:PASS:53:0,3,59:0,0:1,0"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonContains("\"variantType\":\"indel\"", annotatedVariant); }
public void Test_Pre() { DepthFirstOrder order = new DepthFirstOrder(this.CreateDigraph()); AssertUtilities.Sequence(new Int32[6] { 0, 3, 4, 5, 1, 2 }, order.Pre()); }
public void Test_Post() { DepthFirstOrder order = new DepthFirstOrder(this.CreateDigraph()); AssertUtilities.Sequence(new Int32[6] { 5, 4, 3, 2, 1, 0 }, order.Post()); }
public void Test_ReversePost() { DepthFirstOrder order = new DepthFirstOrder(this.CreateDigraph()); AssertUtilities.Sequence(new Int32[6] { 0, 1, 2, 3, 4, 5 }, order.ReversePost()); }
public void Test_ToIndices() { Alphabet alphabet = Alphabet.Decimal; AssertUtilities.Sequence(new Int32[3] { 7, 8, 9 }, alphabet.ToIndices("789")); }
public void SuppIntervalCnv() { var annotatedVariant = DataUtilities.GetSuppIntervalVariant(Resources.MiniSuppAnnot("chr1_713035_713060.nsa"), "chr1 713045 . T <CN1> . LowGQX;HighDPFRatio END=718045;SVTYPE=CNV;BLOCKAVG_min30p3a GT:GQX:DP:DPF .:.:0:1"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckIntervalCount(28, annotatedVariant); AssertUtilities.CheckJsonContains("variantType\":\"copy_number_variation\"", annotatedVariant); }
public void RefNameMismatch() { var annotatedVariant = DataUtilities.GetVariant(DataUtilities.EmptyCachePrefix, Resources.MiniSuppAnnot("chr1_672000_672092.nsa"), "chr1 672000 . C <DEL> 0.1 LowQ SVTYPE=DEL;END=672092;ALTDEDUP=1;ALTDUP=0;REFDEDUP=0;REFDUP=0;INTERGENIC=False . ."); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonContains("dgv1n111", annotatedVariant); }
public void GatkGenomeVcf() { const bool isGatkGenomeVcf = true; var vcfVariant = VcfUtilities.GetVcfVariant("1 10360 . C <NON_REF> . PASS END=10362 GT:DP:GQ:MIN_DP:PL 0/0:198:99:196:0,120,1800", isGatkGenomeVcf); var annotatedVariant = DataUtilities.GetVariant(Resources.CacheGRCh37("ENST00000483270_chr1_Ensembl84"), vcfVariant); Assert.NotNull(annotatedVariant); AssertUtilities.CheckAlleleCount(0, annotatedVariant); }
public void Test_ToChars() { Alphabet alphabet = Alphabet.Decimal; AssertUtilities.Sequence(new Char[3] { '7', '8', '9' }, alphabet.ToChars(new Int32[3] { 7, 8, 9 })); }
public void SvDelPartiallyOverlappingGene() { var annotatedVariant = DataUtilities.GetVariant(Resources.CacheGRCh37("ENST00000546909_chr14_Ensembl84"), "14 19443800 . G <DEL> . PASS SVTYPE=DEL;END=19452000"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonContains("\"overlappingGenes\":[\"RP11-536C10.15\"]", annotatedVariant); AssertUtilities.CheckJsonContains("ENST00000546909", annotatedVariant); }
public void NextToGene() { var annotatedVariant = DataUtilities.GetVariant(Resources.CacheGRCh37("ENST00000546909_chr14_Ensembl84"), "14 19443847 14_19462000 G <CNV> . PASS SVTYPE=CNV;END=19462000;CN=0;CNscore=13.41;LOH=0;ensembl_gene_id=ENSG00000257990,ENSG00000257558"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonDoesNotContain("\"overlappingGenes\":[\"RP11-536C10.15\"]", annotatedVariant); AssertUtilities.CheckJsonDoesNotContain("ENST00000546909", annotatedVariant); }
public void InsertionReciprocalOverlap() { var annotatedVariant = DataUtilities.GetVariant(DataUtilities.EmptyCachePrefix, Resources.MiniSuppAnnot("chr1_756265_756269.nsa"), "1 756267 . T <INS> . PASS SVTYPE=INS;END=756267"); Assert.NotNull(annotatedVariant); AssertUtilities.CheckJsonDoesNotContain("\"reciprocalOverlap\":NaN", annotatedVariant); AssertUtilities.CheckJsonContains("esv1032937", annotatedVariant); AssertUtilities.CheckJsonDoesNotContain("\"reciprocalOverlap\"", annotatedVariant); }