public void ThatSearchingForMultipleColoursWillReturnBothColorsCorrectly()
        {
            var shirts = new[]
            {
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Small, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Red),
            };

            var lookupTable = new ShirtLookupTable(shirts);

            var options = new SearchOptions();

            options.Colors.Add(Color.Blue);
            options.Colors.Add(Color.Red);

            var result = lookupTable.Find(options);

            Assert.AreEqual(4, result.Count());
            Assert.AreEqual(3, result.Count(r => r.Color == Color.Blue));
            Assert.AreEqual(1, result.Count(r => r.Color == Color.Red));
        }
        public void WhenTheSearchOptionsAreNullAnEmptyListIsReturned()
        {
            var shirts = new[]
            {
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Small, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
            };

            var lookupTable = new ShirtLookupTable(shirts);
            var result      = lookupTable.Find(null);

            Assert.AreEqual(0, result.Count());
        }
        public void ThatFindingAShirtByColorWillReturnAllShirtsOfTheCorrectColor()
        {
            var shirts = new[]
            {
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Small, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
            };

            var lookupTable = new ShirtLookupTable(shirts);

            var options = new SearchOptions();

            options.Colors.Add(Color.Black);

            var result = lookupTable.Find(options);

            Assert.AreEqual(2, result.Count());
        }
        public void ThatFindingBySizeWillFindTheCorrectNumberOfResults()
        {
            var shirts = new[]
            {
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Small, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Large, Color.Black),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Blue),
                new Shirt(Guid.NewGuid(), string.Empty, Size.Medium, Color.Red),
            };

            var lookupTable = new ShirtLookupTable(shirts);

            var options = new SearchOptions();

            options.Sizes.Add(Size.Medium);

            var result = lookupTable.Find(options);

            Assert.AreEqual(3, result.Count());
            Assert.IsTrue(result.All(r => r.Size == Size.Medium));
        }