Zebra Game Kata Part 8 - Answer Tests.

Here are the tests I wrote.

ZebraGameTest/ZebraProblemTest.cs
using System.Linq;

using NUnit.Framework;

using ZebraGameProblem;

namespace ZebraGameTests
{
    [TestFixture]
    public class ZebraProblemTest
    {
        [SetUp]
        public void Setup()
        {
            zebraProblem = new ZebraProblem();
        }

        private ZebraProblem zebraProblem;

        [Test]
        public void Apples_are_eaten_in_the_house_next_to_the_house_where_the_horse_is_kept()
        {
            var appleHouse = zebraProblem.Houses.First( h => h.Food == Food.Apple );

            var horseHouse = zebraProblem.Houses.First( h => h.Pet == Pet.Horse );

            Assert.That( appleHouse.Id == horseHouse.Id + 1 || appleHouse.Id == horseHouse.Id - 1,
                         "Apples are eaten in the house next to the house where the horse is kept." );
        }

        [Test]
        public void Apples_are_eaten_in_the_house_with_the_yellow_door()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Food == Food.Apple
                                                       && h.DoorColor == DoorColor.Yellow ),
                         "Apples are eaten in the house with the yellow door." );
        }

        [Test]
        public void Australian_lives_in_the_house_with_the_red_door()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Nationality == Nationality.Australian
                                                       && h.DoorColor == DoorColor.Red ),
                         "The Australian needs to live in the house with the red door." );
        }

        [Test]
        public void Coffee_is_drunk_in_the_house_with_the_green_door()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Drink == Drink.Coffee
                                                       && h.DoorColor == DoorColor.Green ),
                         "Coffee is drunk in the house with the green door." );
        }

        [Test]
        public void Green_door_is_immediately_to_the_right_of_ivory_door()
        {
            var greenDoorHouse = zebraProblem.Houses.First( h => h.DoorColor == DoorColor.Green );

            var ivoryDoorHouse = zebraProblem.Houses.First( h => h.DoorColor == DoorColor.Ivory );

            Assert.That( ivoryDoorHouse.Id + 1,
                         Is.EqualTo( greenDoorHouse.Id ),
                         "Green door should be on right of ivory door." );
        }

        [Test]
        public void Italian_owns_the_dog()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Nationality == Nationality.Italian
                                                       && h.Pet == Pet.Dog ),
                         "The Italian owns the dog." );
        }

        [Test]
        public void Milk_is_drunk_in_the_middle_house()
        {
            var milkHouse = zebraProblem.Houses.First( h => h.Drink == Drink.Milk );

            Assert.That( milkHouse.Id,
                         Is.EqualTo( 3 ),
                         "Milk is drunk in the middle house." );
        }

        [Test]
        public void Norwegian_lives_in_the_first_house_on_the_left()
        {
            var NorwegianHouse = zebraProblem.Houses.First( h => h.Nationality == Nationality.Norwegian );

            Assert.That( NorwegianHouse.Id,
                         Is.EqualTo( 1 ),
                         "The Norwegian lives in the first house on the left." );
        }

        [Test]
        public void The_cake_eater_drinks_orange_juice()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Food == Food.Cake
                                                       && h.Drink == Drink.OrangeJuice ),
                         "The cake-eater drinks orange juice." );
        }

        [Test]
        public void The_mushroom_eater_owns_snails()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Food == Food.Mushroom
                                                       && h.Pet == Pet.Snails ),
                         "The mushroom-eater owns snails." );
        }

        [Test]
        public void The_Norwegian_lives_next_to_the_house_with_the_blue_door()
        {
            var NorwegianHouse = zebraProblem.Houses.First( h => h.Nationality == Nationality.Norwegian );

            var blueDoorHouse = zebraProblem.Houses.First( h => h.DoorColor == DoorColor.Blue );

            Assert.That( NorwegianHouse.Id == blueDoorHouse.Id + 1 || NorwegianHouse.Id == blueDoorHouse.Id - 1,
                         "The Norwegian lives next to the house with the blue door." );
        }

        [Test]
        public void The_person_who_eats_onions_lives_in_the_house_next_to_the_person_with_the_fox()
        {
            var onionsHouse = zebraProblem.Houses.First( h => h.Food == Food.Onion );

            var foxHouse = zebraProblem.Houses.First( h => h.Pet == Pet.Fox );

            Assert.That( onionsHouse.Id == foxHouse.Id + 1 || onionsHouse.Id == foxHouse.Id - 1,
                         "The person who eats onions lives in the house next to the person with the fox." );
        }

        [Test]
        public void The_Ukrainian_drinks_tea()
        {
            Assert.That( zebraProblem.Houses.Any( h => h.Nationality == Nationality.Ukrainian
                                                       && h.Drink == Drink.Tea ),
                         "The Ukrainian drinks tea." );
        }

        [Test]
        public void There_Are_Five_Houses()
        {
            Assert.That( zebraProblem.Houses.Count,
                         Is.EqualTo( 5 ),
                         "There must be five houses." );
        }

        [Test]
        public void Unique_Drinks()
        {
            zebraProblem.Houses.ForEach( house =>
                 Assert.That( zebraProblem.Houses
                                          .Count( h => h.Drink == house.Drink ),
                              Is.EqualTo( 1 ),
                              "A house was found with the same drink as house {0}.",
                              house.Id ) );
        }

        [Test]
        public void Unique_Foods()
        {
            zebraProblem.Houses.ForEach( house =>
                 Assert.That( zebraProblem.Houses
                                          .Count( h => h.Food == house.Food ),
                              Is.EqualTo( 1 ),
                              "A house was found with the same food as house {0}.",
                              house.Id ) );
        }

        [Test]
        public void Unique_Front_Doors()
        {
            zebraProblem.Houses.ForEach( house =>
                 Assert.That( zebraProblem.Houses
                                          .Count( h => h.DoorColor == house.DoorColor ),
                              Is.EqualTo( 1 ),
                              "A house was found with the same color door as house {0}.",
                              house.Id ) );
        }

        [Test]
        public void Unique_House_Id()
        {
            zebraProblem.Houses.ForEach(
                house => Assert.That( zebraProblem.Houses.Count( h => h.Id == house.Id ),
                                      Is.EqualTo( 1 ),
                                      "A house was found with the same ID as house {0}.",
                                      house.Id ) );
        }

        [Test]
        public void Unique_Nationalities()
        {
            zebraProblem.Houses.ForEach( house =>
                 Assert.That( zebraProblem.Houses
                                          .Count( h => h.Nationality == house.Nationality ),
                              Is.EqualTo( 1 ),
                              "A house was found with the same nationality as house {0}.",
                              house.Id ) );
        }

        [Test]
        public void Unique_Pets()
        {
            zebraProblem.Houses.ForEach( house =>
                 Assert.That( zebraProblem.Houses
                                          .Count( h => h.Pet == house.Pet ),
                              Is.EqualTo( 1 ),
                              "A house was found with the same pet as house {0}.",
                              house.Id ) );
        }
    }
}