Esempio n. 1
0
        public async Task GetVerticals_WhenNxNMatrix_ShouldReturnTranspose()
        {
            var dna = new List <string>
            {
                "ABCDEF",
                "GHIJKL",
                "MNOPQR",
                "STUVWX",
                "YZ1234",
                "567890"
            };
            var transpose = new List <string>
            {
                "AGMSY5",
                "BHNTZ6",
                "CIOU17",
                "DJPV28",
                "EKQW39",
                "FLRX40",
            };

            var result = await UtilsArray.GetVerticals(dna);

            Assert.Equal(transpose, result);
        }
Esempio n. 2
0
        public async Task <bool> IsMutant(List <string> dna)
        {
            var total = dna.Count(item => _itemsToSearch.Where(item.Contains).Any());

            if (total > 1)
            {
                return(true);
            }
            var verticals = await UtilsArray.GetVerticals(dna);

            total += verticals.Count(item => _itemsToSearch.Where(item.Contains).Any());
            if (total > 1)
            {
                return(true);
            }
            var obliques = await UtilsArray.GetObliques(dna);

            total += obliques.Count(item => _itemsToSearch.Where(item.Contains).Any());
            return(total > 1);
        }