public void ValidateRnaAlphabetAdd() { // Gets the actual sequence and the alphabet from the Xml string alphabetName = Utility._xmlUtil.GetTextValue( Constants.SimpleRnaAlphabetNode, Constants.AlphabetNameNode); string actualSequence = Utility._xmlUtil.GetTextValue( Constants.SimpleRnaAlphabetNode, Constants.ExpectedSingleChar); ISequence seq = new Sequence(Utility.GetAlphabet(alphabetName), actualSequence); RnaAlphabet alp = RnaAlphabet.Instance; try { alp.Add(seq[0]); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of Add() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of Add() method completed successfully."); } }
public void TestAllAlphabetsToString() { DnaAlphabet dna = DnaAlphabet.Instance; RnaAlphabet rna = RnaAlphabet.Instance; ProteinAlphabet protein = ProteinAlphabet.Instance; AmbiguousDnaAlphabet dnaAmbiguous = AmbiguousDnaAlphabet.Instance; AmbiguousRnaAlphabet rnaAmbiguous = AmbiguousRnaAlphabet.Instance; AmbiguousProteinAlphabet proteinAmbiguous = AmbiguousProteinAlphabet.Instance; string dnaStringActual = dna.ToString(); string rnaStringActual = rna.ToString(); string proteinStringActual = protein.ToString(); string dnaAmbiguousStringActual = dnaAmbiguous.ToString(); string rnaAmbiguousStringActual = rnaAmbiguous.ToString(); string proteinAmbiguousStringActual = proteinAmbiguous.ToString(); string dnaStringExpected = "ACGT-"; string rnaStringExpected = "ACGU-"; string proteinStringExpected = "ACDEFGHIKLMNOPQRSTUVWY-*"; string dnaAmbiguousStringExpected = "ACGT-MRSWYKVHDBN"; string rnaAmbiguousStringExpected = "ACGU-NMRSWYKVHDB"; string proteinAmbiguousStringExpected = "ACDEFGHIKLMNOPQRSTUVWY-*XZBJ"; Assert.AreEqual(dnaStringExpected, dnaStringActual); Assert.AreEqual(rnaStringExpected, rnaStringActual); Assert.AreEqual(proteinStringExpected, proteinStringActual); Assert.AreEqual(dnaAmbiguousStringExpected, dnaAmbiguousStringActual); Assert.AreEqual(rnaAmbiguousStringExpected, rnaAmbiguousStringActual); Assert.AreEqual(proteinAmbiguousStringExpected, proteinAmbiguousStringActual); }
public void ValidateRnaAlphabetCompareSymbols() { RnaAlphabet alp = RnaAlphabet.Instance; Assert.IsTrue(alp.CompareSymbols(65, 65)); ApplicationLog.WriteLine( "Alphabets BVT: Validation of CompareSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of CompareSymbols() method completed successfully."); }
public void ValidateRnaAlphabetLookupBySymbol() { RnaAlphabet alp = RnaAlphabet.Instance; ISequenceItem itm = alp.LookupBySymbol("A"); Assert.AreEqual('A', itm.Symbol); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of LookupBySymbol() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of LookupBySymbol() method completed successfully."); }
public void ValidateRnaAlphabetLookupAll() { RnaAlphabet alp = RnaAlphabet.Instance; List <ISequenceItem> itm = alp.LookupAll(true, true, true, true); Assert.AreEqual(15, itm.Count); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of LookupAll() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of LookupAll() method completed successfully."); }
public void InValidateRnaAlphabetContains() { RnaAlphabet alp = RnaAlphabet.Instance; Assert.AreEqual(false, alp.Contains(null as ISequenceItem)); ISequence seq = new Sequence(Alphabets.RNA, "AGCUB"); Assert.AreEqual(true, alp.Contains(seq[4])); ApplicationLog.WriteLine( "Alphabets P2: Validation of Contains() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of Contains() method completed successfully."); }
public void ValidateRnaAlphabetCopyTo() { ISequence seq = new Sequence(Alphabets.RNA, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); RnaAlphabet alp = RnaAlphabet.Instance; ISequenceItem[] item = seq.ToArray(); alp.CopyTo(item, 0); Assert.AreEqual('A', item[0].Symbol); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of CopyTo() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of CopyTo() method completed successfully."); }
public void InValidateRnaAlphabetRemove() { try { RnaAlphabet alp = RnaAlphabet.Instance; alp.Remove(null as ISequenceItem); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of Remove() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of Remove() method completed successfully."); } }
public void TestRnaAlphabetTryGetComplementSymbol() { byte basicSymbols; RnaAlphabet rnaAlphabet = RnaAlphabet.Instance; Assert.AreEqual(true, rnaAlphabet.TryGetComplementSymbol((byte)'A', out basicSymbols)); Assert.AreEqual('U', (char)basicSymbols); Assert.AreEqual(true, rnaAlphabet.TryGetComplementSymbol((byte)'U', out basicSymbols)); Assert.AreEqual('A', (char)basicSymbols); Assert.AreEqual(true, rnaAlphabet.TryGetComplementSymbol((byte)'G', out basicSymbols)); Assert.AreEqual('C', (char)basicSymbols); Assert.AreEqual(true, rnaAlphabet.TryGetComplementSymbol((byte)'C', out basicSymbols)); Assert.AreEqual('G', (char)basicSymbols); }
public void InValidateRnaAlphabetGetBasicSymbols() { RnaAlphabet alp = RnaAlphabet.Instance; try { alp.GetBasicSymbols(null); Assert.Fail(); } catch (ArgumentException) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of GetBasicSymbols() method completed successfully."); } }
public void ValidateRnaAlphabetAllProperties() { RnaAlphabet alp = RnaAlphabet.Instance; Assert.AreEqual(16, alp.Count); Assert.AreEqual('-', alp.DefaultGap.Symbol); Assert.IsTrue(alp.HasAmbiguity); Assert.IsTrue(alp.HasGaps); Assert.IsFalse(alp.HasTerminations); Assert.IsTrue(alp.IsReadOnly); Assert.AreEqual("RNA", alp.Name); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of All properties completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of All properties method completed successfully."); }
public void ValidateRnaAlphabetClear() { RnaAlphabet alp = RnaAlphabet.Instance; try { alp.Clear(); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of Clear() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of Clear() method completed successfully."); } }
public void InValidateRnaAlphabetLookupBySymbol() { RnaAlphabet alp = RnaAlphabet.Instance; try { ISequenceItem itm = alp.LookupBySymbol(""); Assert.IsNotNull(itm); Assert.Fail(); } catch (ArgumentException) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of LookupBySymbol() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of LookupBySymbol() method completed successfully."); } }
public void ValidateRnaAlphabetGetConsensusSymbol() { ISequence seq = new Sequence(Alphabets.RNA, "CGUGA"); RnaAlphabet alp = RnaAlphabet.Instance; HashSet <ISequenceItem> hashSet = new HashSet <ISequenceItem>(); foreach (ISequenceItem item in seq) { hashSet.Add(item); } Assert.IsNotNull(alp.GetConsensusSymbol(hashSet)); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); }
public void ValidateRnaAlphabetGetBasicSymbols() { ISequence seq = new Sequence(Alphabets.RNA, "AGCUB"); RnaAlphabet alp = RnaAlphabet.Instance; ISequenceItem item = seq[4]; Assert.IsNotNull(alp.GetBasicSymbols(item)); item = seq[3]; Assert.IsNotNull(alp.GetBasicSymbols(item)); item = seq[3]; Assert.IsNotNull(alp.GetBasicSymbols(item)); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); }
public void ValidateAllAlphabetsToString() { DnaAlphabet dna = DnaAlphabet.Instance; RnaAlphabet rna = RnaAlphabet.Instance; ProteinAlphabet protein = ProteinAlphabet.Instance; AmbiguousDnaAlphabet dnaAmbiguous = AmbiguousDnaAlphabet.Instance; AmbiguousRnaAlphabet rnaAmbiguous = AmbiguousRnaAlphabet.Instance; AmbiguousProteinAlphabet proteinAmbiguous = AmbiguousProteinAlphabet.Instance; string dnaStringActual = dna.ToString(); string rnaStringActual = rna.ToString(); string proteinStringActual = protein.ToString(); string dnaAmbiguousStringActual = dnaAmbiguous.ToString(); string rnaAmbiguousStringActual = rnaAmbiguous.ToString(); string proteinAmbiguousStringActual = proteinAmbiguous.ToString(); Assert.AreEqual("ACGT-", dnaStringActual); Assert.AreEqual("ACGU-", rnaStringActual); Assert.AreEqual("ACDEFGHIKLMNOPQRSTUVWY-*", proteinStringActual); Assert.AreEqual("ACGT-MRSWYKVHDBN", dnaAmbiguousStringActual); Assert.AreEqual("ACGU-NMRSWYKVHDB", rnaAmbiguousStringActual); Assert.AreEqual("ACDEFGHIKLMNOPQRSTUVWY-*XZBJ", proteinAmbiguousStringActual); }
public void TestRnaAlphabetCompareSymbols() { RnaAlphabet rnaAlphabet = RnaAlphabet.Instance; Assert.AreEqual(true, rnaAlphabet.CompareSymbols((byte)'A', (byte)'A')); Assert.AreEqual(true, rnaAlphabet.CompareSymbols((byte)'U', (byte)'U')); Assert.AreEqual(true, rnaAlphabet.CompareSymbols((byte)'G', (byte)'G')); Assert.AreEqual(true, rnaAlphabet.CompareSymbols((byte)'C', (byte)'C')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'A', (byte)'U')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'A', (byte)'G')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'A', (byte)'C')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'U', (byte)'A')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'U', (byte)'G')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'U', (byte)'C')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'G', (byte)'A')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'G', (byte)'U')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'G', (byte)'C')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'C', (byte)'A')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'C', (byte)'U')); Assert.AreEqual(false, rnaAlphabet.CompareSymbols((byte)'C', (byte)'G')); }