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 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);
            }
        }
Exemple #3
0
        public void MeliIntegrationTestShouldWorksWhenConfigurationIsCreatedFromJSON()
        {
            string json = @"
                {
                  'configuration': [
                    {
                      'type': 'analysisset',
                      'name': 'mutant',
                      'analyses': [
                        {
                          'type': 'quantity',
                          'min': 2,
                          'search': [
                            {
                              'type': 'alldirectionssequencequantity',
                              'sequence': 'AAAA'
                            },
                            {
                              'type': 'alldirectionssequencequantity',
                              'sequence': 'TTTT'
                            },
                            {
                              'type': 'alldirectionssequencequantity',
                              'sequence': 'CCCC'
                            },
                            {
                              'type': 'alldirectionssequencequantity',
                              'sequence': 'GGGG'
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
            ";

            /// Creo el Factory Principal, que va a crear la lista de analysis set
            IAnalysisSetFactory analysisSetFactory = new AnalysisSetFactory();

            Mock <IQuantitySearch> quantitySearchMock = new Mock <IQuantitySearch>();
            Mock <IAnalysisResult> resultMock         = new Mock <IAnalysisResult>();
            Mock <IUnityContainer> containerMock      = new Mock <IUnityContainer>();

            containerMock.Setup(m => m.Resolve(typeof(IAnalysisResult), "quantityAnalysisResult", It.IsAny <ParameterOverride>(), It.IsAny <ParameterOverride>(), It.IsAny <ParameterOverride>())).Returns(resultMock.Object);
            containerMock.Setup(m => m.Resolve(typeof(IQuantitySearch), "allDirectionsSequenceQuantitySearch", It.IsAny <ParameterOverride>())).Returns(quantitySearchMock.Object);

            /// Creo el Factory de resultados de analisis de cantidad
            IQuantityAnalysisResultFactory quantityAnalysisResultFactory = new QuantityAnalysisResultFactory(containerMock.Object);
            IQuantityAnalysisFactory       quantityAnalysisFactory       = new QuantityAnalysisFactory(quantityAnalysisResultFactory);

            /// Creo la lista de busquedas por cantidad disponibles
            Dictionary <string, IQuantitySearchJSONFactory> availableSearchFactories = new Dictionary <string, IQuantitySearchJSONFactory>();

            /// Agrego la busqueda por todas las direcciones
            AllDirectionsSequenceQuantitySearchFactory allDirectionsSequenceQuantitySearchFactory = new AllDirectionsSequenceQuantitySearchFactory(containerMock.Object);
            IQuantitySearchJSONFactory allDirectionsQuantityJSONFactory = new QuantitySearchJSONFactory(allDirectionsSequenceQuantitySearchFactory, AllDirectionsSequenceQuantitySearch.ClassType);

            availableSearchFactories.Add(AllDirectionsSequenceQuantitySearch.ClassType, allDirectionsQuantityJSONFactory);

            /// Creo el Factory de busquedas por cantidad, con las busquedas por cantidad disponibles
            IQuantitySearchTypesFactory quantitySearchTypesFactory  = new QuantitySearchTypesFactory(availableSearchFactories);
            QuantityAnalysisJSONFactory quantityAnalysisJSONFactory = new QuantityAnalysisJSONFactory(quantityAnalysisFactory, quantitySearchTypesFactory);

            Dictionary <string, IAnalysisJSONFactory> availableAnalysisFactories = new Dictionary <string, IAnalysisJSONFactory>();

            availableAnalysisFactories.Add(QuantityAnalysis.ClassKey, quantityAnalysisJSONFactory);

            IAnalysisTypesFactory analysisTypesFactory = new AnalysisTypesFactory(availableAnalysisFactories);

            AnalysisSetJSONFactory factory = new AnalysisSetJSONFactory(analysisSetFactory, analysisTypesFactory);

            IEnumerable <IAnalysisSet> analysisSets = factory.CreateInstance(json);

            Assert.IsTrue(analysisSets != null);

            foreach (var analysisSet in analysisSets)
            {
                {
                    IDNAConfiguration dnaConfiguration = this.GetDNAConfiguration();
                    string[]          components       = new string[] { "ATGCGA", "CAGTGC", "TTATGT", "AGAAGG", "CCCCTA", "TCACTG" };
                    IDNA dna = new DNA(dnaConfiguration, components);
                    List <IAnalysisResult> results = new List <IAnalysisResult>(analysisSet.Analyze(dna));
                    Assert.AreEqual(resultMock.Object, results[0]);
                }
            }
        }
Exemple #4
0
 public DNA(IDNAConfiguration dnaConfiguration, string[] components)
 {
     this.Components       = components;
     this.dnaConfiguration = dnaConfiguration;
 }
        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);
            }
        }