1
exercism fetch csharp nucleotide-count

NucleotideCountTest.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This file was auto-generated based on version 1.2.0 of the canonical data.

using Xunit;
using System.Collections.Generic;

public class NucleotideCountTest
{
    [Fact]
    public void Empty_strand()
    {
        var sut = new NucleotideCount("");
        var expected = new Dictionary<char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 0,
            ['T'] = 0
        };
        Assert.Equal(expected, sut.NucleotideCounts);
    }

    [Fact(Skip = "Remove to run test")]
    public void Can_count_one_nucleotide_in_single_character_input()
    {
        var sut = new NucleotideCount("G");
        var expected = new Dictionary<char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 1,
            ['T'] = 0
        };
        Assert.Equal(expected, sut.NucleotideCounts);
    }

    [Fact(Skip = "Remove to run test")]
    public void Strand_with_repeated_nucleotide()
    {
        var sut = new NucleotideCount("GGGGGGG");
        var expected = new Dictionary<char, int>
        {
            ['A'] = 0,
            ['C'] = 0,
            ['G'] = 7,
            ['T'] = 0
        };
        Assert.Equal(expected, sut.NucleotideCounts);
    }

    [Fact(Skip = "Remove to run test")]
    public void Strand_with_multiple_nucleotides()
    {
        var sut = new NucleotideCount("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
        var expected = new Dictionary<char, int>
        {
            ['A'] = 20,
            ['C'] = 12,
            ['G'] = 17,
            ['T'] = 21
        };
        Assert.Equal(expected, sut.NucleotideCounts);
    }

    [Fact(Skip = "Remove to run test")]
    public void Strand_with_invalid_nucleotides()
    {
        Assert.Throws<InvalidNucleotideException>(() => new NucleotideCount("AGXXACT"));
    }
}