public static void Launch()
 {
     StringReverse.StringReverseTest();     //wywołuję metodę statyczną testującą klasę .cs
     LeapYear.LeapYearTest();
     SumOfMultiples.SumOfMultiplesTest();
     Raindrops.RaindropsTest();
     NucleotideCount.NucleotideCountTest();
     Accumulate.AccumulateTest();
 }
示例#2
0
    public void Empty_strand()
    {
        var expected = new Dictionary <char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 0,
            ['T'] = 0
        };

        Assert.Equal(expected, NucleotideCount.Count(""));
    }
示例#3
0
    public void Strand_with_multiple_nucleotides()
    {
        var expected = new Dictionary <char, int>
        {
            ['A'] = 20,
            ['C'] = 12,
            ['G'] = 17,
            ['T'] = 21
        };

        Assert.Equal(expected, NucleotideCount.Count("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"));
    }
示例#4
0
    public void Strand_with_repeated_nucleotide()
    {
        var expected = new Dictionary <char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 7,
            ['T'] = 0
        };

        Assert.Equal(expected, NucleotideCount.Count("GGGGGGG"));
    }
示例#5
0
    public void Can_count_one_nucleotide_in_single_character_input()
    {
        var expected = new Dictionary <char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 1,
            ['T'] = 0
        };

        Assert.Equal(expected, NucleotideCount.Count("G"));
    }
示例#6
0
        public void Count_MultipleDifferentNucleotides_CountsCorrectNucleotides()
        {
            var expected = new Dictionary <char, int>
            {
                ['A'] = 20,
                ['C'] = 12,
                ['G'] = 17,
                ['T'] = 21
            };

            Assert.AreEqual(expected, NucleotideCount.Count("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"));
        }
    public void Strand_case_does_not_matter()
    {
        var expected = new Dictionary <char, int>
        {
            ['A'] = 2,
            ['C'] = 2,
            ['G'] = 2,
            ['T'] = 2
        };

        Assert.Equal(expected, NucleotideCount.Count("AaCcGgTt"));
    }
示例#8
0
        public void Count_MultipleRepeatNucleotides_CountsCorrectNucleotides()
        {
            var expected = new Dictionary <char, int>
            {
                ['A'] = 0,
                ['C'] = 0,
                ['G'] = 7,
                ['T'] = 0
            };

            Assert.AreEqual(expected, NucleotideCount.Count("GGGGGGG"));
        }
示例#9
0
        public void Count_OneNucleotide_CountsCorrectNucleotide()
        {
            var expected = new Dictionary <char, int>
            {
                ['A'] = 0,
                ['C'] = 0,
                ['G'] = 1,
                ['T'] = 0
            };

            Assert.AreEqual(expected, NucleotideCount.Count("G"));
        }
示例#10
0
        public void Count_EmptyStrand_CorrectResults()
        {
            var expected = new Dictionary <char, int>
            {
                ['A'] = 0,
                ['C'] = 0,
                ['G'] = 0,
                ['T'] = 0
            };

            Assert.AreEqual(expected, NucleotideCount.Count(string.Empty));
        }
示例#11
0
    public static IDictionary <char, int> Count(string sequence)
    {
        if (sequence.Except(Nucleotides).Count() != 0)
        {
            throw new ArgumentException();
        }

        var finalCount = sequence.Aggregate(
            NucleotideCount.Empty(),
            (count, nucleotide) =>
        {
            count[nucleotide]++;
            return(count);
        }
            );

        return(new ReadOnlyDictionary <char, int>(finalCount));
    }
示例#12
0
 public void Strand_with_invalid_nucleotides()
 {
     Assert.Throws <ArgumentException>(() => NucleotideCount.Count("AGXXACT"));
 }
示例#13
0
 public void Count_InvalidNucleotides_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => NucleotideCount.Count("AGXXACT"));
 }