Sha256: 5bb7f90dadb89d6b189b6fcfb8ddd618492b3fafb546083003f06470a9e8fc9e

Contents?: true

Size: 1.87 KB

Versions: 143

Compression:

Stored size: 1.87 KB

Contents

using System.Collections.Generic;
using Xunit;

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

    [Fact(Skip = "Remove to run test")]
    public void Has_no_adenosine()
    {
        var dna = new DNA("");
        Assert.Equal(0, dna.Count('A'));
    }

    [Fact(Skip = "Remove to run test")]
    public void Repetitive_cytidine_gets_counts()
    {
        var dna = new DNA("CCCCC");
        Assert.Equal(5, dna.Count('C'));
    }

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

    [Fact(Skip = "Remove to run test")]
    public void Counts_only_thymidine()
    {
        var dna = new DNA("GGGGTAACCCGG");
        Assert.Equal(1, dna.Count('T'));
    }

    [Fact(Skip = "Remove to run test")]
    public void Counts_a_nucleotide_only_once()
    {
        var dna = new DNA("GGTTGG");
        dna.Count('T');
        Assert.Equal(2, dna.Count('T'));
    }

    [Fact(Skip = "Remove to run test")]
    public void Validates_nucleotides()
    {
        var dna = new DNA("GGTTGG");
        Assert.Throws<InvalidNucleotideException>(() => dna.Count('X'));
    }

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

Version data entries

143 entries across 143 versions & 1 rubygems

Version Path
trackler-2.2.1.40 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.39 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.38 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.37 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.36 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.35 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.34 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.33 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.32 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.31 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.30 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.29 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.28 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.27 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.26 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.25 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.24 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.23 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.22 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs
trackler-2.2.1.21 tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs