Esempio n. 1
0
        public void ExecuteTest()
        {
            // arrange
            int[] excpectedResult     = new int[] { 0, 3, 6, 7 };
            int[] pairwiseDifferences = DNAMappingBase.ProduceMatrix(excpectedResult);
            EnumerateDNAMappingByIntegerTrangle enumeration = new EnumerateDNAMappingByIntegerTrangle(pairwiseDifferences, 0);

            // act
            enumeration.Execute();
            // assert
            var result = enumeration.ListOfSolution.FirstOrDefault(l => l.SequenceEqual(excpectedResult));

            Assert.IsNotNull(result, $"Expected result absent in solution list");
        }
        //--------------------------------------------------------------------------------------
        protected override bool MakeAction()
        {
            if (_fCurrentPosition == _fSize - 1)
            {
                int[] pairwiseDifferences = _fCurrentSet.ToArray();
                EnumerateDNAMappingByIntegerTrangle enumeration = new EnumerateDNAMappingByIntegerTrangle(pairwiseDifferences, 0)
                {
                    StatisticAccumulator = _statisticAccumulator
                };
                enumeration.Execute();

                _result.Add(string.Join(",", _fCurrentSet.Select(t => t.ToString())));
            }
            return(false);
        }
        public void ExecuteTestCase2()
        {
            // arrange
            int[]  excpectedResult             = new int[] { 0, 3, 5, 8 };
            int[]  pairwiseDifferences         = DNAMappingBase.ProduceMatrix(excpectedResult);
            string pairwiseDifferencesAsString = string.Join(",", pairwiseDifferences.OrderBy(p => p));
            EnumerateDNAMappingByIntegerTrangle enumeration = new EnumerateDNAMappingByIntegerTrangle(pairwiseDifferences, 0)
            {
                StatisticAccumulator = new FakeDNAMappingStatisticAccumulator()
            };

            // act
            enumeration.Execute();
            // assert
            var result = enumeration.ListOfSolution.FirstOrDefault(l => l.SequenceEqual(excpectedResult));

            Assert.IsNotNull(result, $"Expected result absent in solution list");
        }