ABC Problem Sample C# Code

Code:

public class ABCProblem
{
    private readonly IEnumerable<string> m_Blocks;

    public ABCProblem()
    {
        m_Blocks = new List<string>
        {
            "bo", "xk", "dq",
            "cp", "na", "gt",
            "re", "tg", "qd",
            "fs", "jw", "hu",
            "vi", "an", "ob",
            "er", "fs", "ly",
            "pc", "zm"
        };
    }

    public ABCProblem(IEnumerable<string> blocks)
    {
        m_Blocks = blocks;
    }

    public bool CheckWord(string word)
    {
        var myBlocks = new List<string>(m_Blocks);

        foreach (char letter in word)
        {
            char lowerLetter = char.ToLower(letter);

            string block = myBlocks.FirstOrDefault(b => b.Contains(lowerLetter));
            if (!string.IsNullOrEmpty(block))
            {
                myBlocks.Remove(block);
            }
            else return false;
        }

        return true;
    }
}

Test:

[TestFixture]
public class ABCProblemTest
{
    [TestCase("", true)]
    [TestCase("A", true)]
    [TestCase("baRk", true)]
    [TestCase("booK", false)]
    [TestCase("treat", true)]
    [TestCase("COMMON", false)]
    [TestCase("squad", true)]
    [TestCase("Confused", true)]
    public void CheckWord(string value, bool expected)
    {
        // arrange
        var abc = new ABCProblem();

        // act
        bool actual = abc.CheckWord(value);

        // assert
        Assert.AreEqual(expected, actual);
    }
}