public void SutIsMethodQuery()
 {
     // Fixture setup
     // Exercise system
     var sut = new CompositeMethodQuery();
     // Verify outcome
     Assert.IsAssignableFrom<IMethodQuery>(sut);
     // Teardown
 }
 public void QueriesWillNotBeNullWhenSutIsCreatedWithDefaultConstructor()
 {
     // Fixture setup
     var sut = new CompositeMethodQuery();
     // Exercise system
     IEnumerable<IMethodQuery> result = sut.Queries;
     // Verify outcome
     Assert.NotNull(result);
     // Teardown
 }
 public void QueriesWillMatchParamsArray()
 {
     // Fixture setup
     var expectedQueries = new IMethodQuery[]
     {
         new DelegatingMethodQuery(),
         new DelegatingMethodQuery(),
         new DelegatingMethodQuery()
     };
     var sut = new CompositeMethodQuery(expectedQueries);
     // Exercise system
     var result = sut.Queries;
     // Verify outcome
     Assert.True(expectedQueries.SequenceEqual(result));
     // Teardown
 }
        public void SelectWillReturnResultsInCorrectSequence(Type type)
        {
            // Fixture setup
            IEnumerable<IMethod> modestConstructors = from ci in type.GetConstructors()
                                                      let parameters = ci.GetParameters()
                                                      orderby parameters.Length ascending
                                                      select new ConstructorMethod(ci) as IMethod;

            IEnumerable<IMethod> greedyConstructors = from ci in type.GetConstructors()
                                                      let parameters = ci.GetParameters()
                                                      orderby parameters.Length descending
                                                      select new ConstructorMethod(ci) as IMethod;

            var expectedConstructors = new List<IMethod>();
            expectedConstructors.AddRange(modestConstructors);
            expectedConstructors.AddRange(greedyConstructors);

            var queries = new IMethodQuery[]
            {
                new DelegatingMethodQuery { OnSelectMethods = t => modestConstructors },
                new DelegatingMethodQuery { OnSelectMethods = t => greedyConstructors },
                new DelegatingMethodQuery()
            };

            var sut = new CompositeMethodQuery(queries);
            // Exercise system
            var result = sut.SelectMethods(type);
            // Verify outcome
            Assert.True(expectedConstructors.SequenceEqual(result));
            // Teardown
        }