public void ConvertToSpecification_returns_null_when_no_viable_strategy(Criterion criterion,
                                                                                [MockedMetadata] IStrategyForConvertingCriterionToSpecification one,
                                                                                [MockedMetadata] IStrategyForConvertingCriterionToSpecification two,
                                                                                [MockedMetadata] IStrategyForConvertingCriterionToSpecification three)
        {
            // Arrange
            var strategies = new [] { one, two, three };
            var sut        = new StrategyBasedCriterionToSpecificationConverter(strategies);

            // Act
            var result = sut.ConvertToSpecification(criterion);

            // Assert
            Assert.That(result, Is.Null);
        }
        public void ConvertToSpecification_uses_a_viable_strategy(Criterion criterion,
                                                                  [MockedMetadata] IStrategyForConvertingCriterionToSpecification one,
                                                                  [MockedMetadata] IStrategyForConvertingCriterionToSpecification two,
                                                                  [MockedMetadata] IStrategyForConvertingCriterionToSpecification three,
                                                                  ISpecificationExpression <Ticket> spec)
        {
            // Arrange
            var strategies = new [] { one, two, three };
            var sut        = new StrategyBasedCriterionToSpecificationConverter(strategies);

            Mock.Get(two.GetMetadata()).Setup(x => x.CanConvert(criterion)).Returns(true);
            Mock.Get(two).Setup(x => x.ConvertToSpecification(criterion)).Returns(spec);

            // Act
            var result = sut.ConvertToSpecification(criterion);

            // Assert
            Assert.That(result, Is.SameAs(spec));
        }