public void GivenValidDnaChainWhenFoundFourEqualProteinsDiagonallyInverseThenReturnTotalOfChains() { //Given string[,] dnaChain = { { "C", "T", "G", "A", "G", "A" }, { "C", "T", "A", "G", "C", "G" }, { "T", "G", "A", "T", "G", "T" }, { "A", "T", "A", "T", "G", "G" }, { "T", "C", "T", "C", "A", "A" }, { "T", "C", "A", "C", "T", "G" } }; //When int totalOfChainsFound = DnaAnalizer.AnalizeDiagonallyInverted(dnaChain); //Then Assert.Equal(1, totalOfChainsFound); }
public void GivenValidDnaChainWhenNotFoundFourEqualProteinsDiagonallyThenReturnZero() { //Given string[,] dnaChain = { { "C", "T", "G", "T", "G", "A" }, { "C", "T", "A", "C", "C", "G" }, { "T", "A", "T", "T", "G", "T" }, { "A", "G", "A", "T", "G", "G" }, { "C", "C", "T", "C", "A", "A" }, { "T", "C", "A", "C", "T", "G" } }; //When int totalOfChainsFound = DnaAnalizer.AnalizeDiagonally(dnaChain); //Then Assert.Equal(0, totalOfChainsFound); }
public void GivenValidDnaChainWhenFoundTwoOrMoreChainsWithFourEqualProteinsHorizontallyThenReturnTotalOfChainsFound() { //Given string[,] dnaChain = { { "C", "T", "G", "A", "G", "A" }, { "C", "T", "G", "A", "C", "G" }, { "T", "A", "A", "A", "A", "T" }, { "A", "T", "A", "T", "G", "G" }, { "T", "T", "T", "T", "A", "A" }, { "T", "C", "A", "C", "T", "G" } }; //When int totalOfChainsFound = DnaAnalizer.AnalizeHorizontally(dnaChain); //Then Assert.Equal(2, totalOfChainsFound); }
public void GivenValidDnaChainWhenFoundMoreThanOneSequenceOfFourEqualProteinsVerticallyThenReturnTotalOfSequencesFound() { //Given string[,] dnaChain = { { "C", "T", "G", "T", "G", "A" }, { "C", "T", "A", "T", "G", "G" }, { "T", "A", "T", "T", "G", "T" }, { "A", "G", "A", "T", "G", "G" }, { "C", "C", "T", "C", "A", "A" }, { "T", "C", "A", "C", "T", "G" } }; //When int totalOfChainsFound = DnaAnalizer.AnalizeVertically(dnaChain); //Then Assert.Equal(2, totalOfChainsFound); }
public static bool isSimian(string[,] dnaChain) { int total = 0; Parallel.Invoke(() => { total += DnaAnalizer.AnalizeDiagonally(dnaChain); }, () => { total += DnaAnalizer.AnalizeDiagonallyInverted(dnaChain); }, () => { total += DnaAnalizer.AnalizeHorizontally(dnaChain); }, () => { total += DnaAnalizer.AnalizeVertically(dnaChain); } ); return(total > 1); }