public void IsMutantIntegrationTestsShouldThrowExceptionWhenDNAComponentsHaveInvalidSizeCaseFour()
        {
            IQuantityAnalysis quantityAnalysis = this.GetQuantityAnalysis();
            IDNAConfiguration dnaConfiguration = this.GetDNAConfiguration();

            {
                /// Negative result from MELI Instructions
                string[] components            = new string[] { "XXX", "XXX" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
            }
        }
        public async Task <IQuantityAnalysisResult> AnalyzeMutant(IDNA dna)
        {
            List <IAnalysisResult>  analysisResult = new List <IAnalysisResult>(this.Analyze("mutant", dna));
            IQuantityAnalysisResult result         = (IQuantityAnalysisResult)analysisResult[0];

            if (await this.MutantRepository.InsertDNA(dna.StringRepresentation()))
            {
                if (result.Result)
                {
                    await this.StatsRepository.IncrementStat(MutantDnaKey);
                }
                else
                {
                    await this.StatsRepository.IncrementStat(HumanDnaKey);
                }
            }

            return(result);
        }
        public void NegativeIsMutantIntegrationTestsShouldReturnFalseEach()
        {
            IQuantityAnalysis quantityAnalysis = this.GetQuantityAnalysis();
            IDNAConfiguration dnaConfiguration = this.GetDNAConfiguration();

            {
                /// Negative result from MELI Instructions
                string[] components            = new string[] { "ATGCGA", "CAGTGC", "TTATTT", "AGACGG", "GCGTCA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsFalse(result.Result);
            }

            {
                /// IsMutantShouldReturnFalse6x6VerticalOnlyCase
                string[] components            = new string[] { "CTGCGA", "CCGAGC", "TTATGT", "TCATGG", "AACCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsFalse(result.Result);
            }
        }
        public async Task <HttpResponseMessage> Post([FromBody] MutantRequest request)
        {
            try
            {
                Log.Debug("Request received");
                IDNA dna = this.DNAFactory.CreateInstance(request.Dna);
                IQuantityAnalysisResult result = await this.DNAAnalyzerService.AnalyzeMutant(dna);

                if (result.Result)
                {
                    return(Request.CreateResponse());
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Is not a mutant"));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public void PositiveIsMutantIntegrationTestsShouldReturnTrueEach()
        {
            IQuantityAnalysis quantityAnalysis = this.GetQuantityAnalysis();
            IDNAConfiguration dnaConfiguration = this.GetDNAConfiguration();

            {
                /// Positive result from MELI Instructions
                string[] components            = new string[] { "ATGCGA", "CAGTGC", "TTATGT", "AGAAGG", "CCCCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturn6x6TrueAscendentVerticalCase
                string[] components            = new string[] { "ATGAGA", "CAATGC", "TAATTT", "AGACTG", "GCGTCA", "TCTCTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturn6x6TrueAscendentVerticalCase
                string[] components            = new string[] { "ATGAGA", "CAATGC", "TAATTT", "AGACTG", "GCGTCA", "TCTCTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6DescendentVerticalCase
                string[] components            = new string[] { "ATGAGA", "CATGGC", "TTATGT", "ATACTG", "GCTTCA", "TCTTTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6DescendentAndAscendantVerticalCase
                string[] components            = new string[] { "ATGTGA", "CATGGC", "TTATGT", "TTACTG", "GCATCA", "TCTTTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue7X7DescendentAndAscendantVerticalCase
                string[] components            = new string[] { "ATGTGAA", "CATGGCC", "TTATGTT", "TTACTGG", "GCATCAA", "TCTTTGG", "ATCCATA" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6HorizontalAndDescendentVerticalCase
                string[] components            = new string[] { "ATGCGA", "CAGTAC", "TTATGT", "AGAAGG", "CCCCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6VerticalAndDescendentVerticalCase
                string[] components            = new string[] { "ATGCGA", "CAGTGC", "TTATGT", "AGAAGG", "CACCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6HorizontalAndAscendantVerticalCase
                string[] components            = new string[] { "ATGAGA", "CAATAC", "TATTGT", "AGAGAG", "CCCCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6VerticalAndAscendantVerticalCase
                string[] components            = new string[] { "CTGCGA", "CCGAGC", "TTATGT", "TAATGG", "AACCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6VerticalOnLimits
                string[] components            = new string[] { "CTGCAG", "CCGACG", "CTATTG", "CCATGG", "AACCTA", "TCACTG" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }

            {
                /// IsMutantShouldReturnTrue6x6HorizontalOnLimits
                string[] components            = new string[] { "CCCCAG", "CCGACC", "TTATTT", "TCATGG", "AACCTA", "TCAAAA" };
                IDNA     dna                   = new DNA(dnaConfiguration, components);
                IQuantityAnalysisResult result = (IQuantityAnalysisResult)quantityAnalysis.Analyze(dna);
                Assert.IsTrue(result.Result);
            }
        }