public void SelectConstructorsFromNullTypeThrows()
 {
     // Fixture setup
     var sut = new ListFavoringConstructorQuery();
     // Exercise system and verify outcome
     Assert.Throws<ArgumentNullException>(() =>
         sut.SelectConstructors(null));
     // Teardown
 }
 public void SelectFromTypeWithNoPublicConstructorReturnsCorrectResult()
 {
     // Fixture setup
     var sut = new ListFavoringConstructorQuery();
     var typeWithNoPublicConstructors = typeof(AbstractType);
     // Exercise system
     var result = sut.SelectConstructors(typeWithNoPublicConstructors);
     // Verify outcome
     Assert.False(result.Any());
     // Teardown
 }
        public void SelectFromTypeReturnsAllAppropriateResults(Type type)
        {
            // Fixture setup
            var expectedConstructors = from ci in type.GetConstructors()
                                       let parameters = ci.GetParameters()
                                       select new ConstructorMethod(ci) as IMethod;

            var sut = new ListFavoringConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(type);
            // Verify outcome
            Assert.True(expectedConstructors.All(m => result.Any(m.Equals)));
            // Teardown
        }
 public void SelectConstructorsFromTypeReturnsFirstMethodThatTakesListAsArgument(Type type)
 {
     var sut = new ListFavoringConstructorQuery();
     // Exercise system
     var result = sut.SelectConstructors(type);
     // Verify outcome
     var genericParameterType = type.GetGenericArguments().Single();
     Assert.True(result.First().Parameters.Any(p => typeof(IList<>).MakeGenericType(genericParameterType).IsAssignableFrom(p.ParameterType)));
     // Teardown
 }