public void SelectReturnsCorrectResultForNonMockTypes(Type t)
 {
     // Fixture setup
     var sut = new MockConstructorQuery();
     // Exercise system
     var result = sut.SelectConstructors(t);
     // Verify outcome
     Assert.Empty(result);
     // Teardown
 }
        public void SelectReturnsCorrectResultForNonMockTypes(Type t)
        {
            // Fixture setup
            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);

            // Verify outcome
            Assert.Empty(result);
            // Teardown
        }
        public void SelectReturnsCorrectNumberOfConstructorsForTypesWithConstructors(Type t)
        {
            // Fixture setup
            var mockType = t.GetGenericArguments().Single();
            var expectedCount = mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length;

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);
            // Verify outcome
            Assert.Equal(expectedCount, result.Count());
            // Teardown
        }
        public void SelectReturnsCorrectNumberOfConstructorsForTypesWithConstructors(Type t)
        {
            // Fixture setup
            var mockType      = t.GetGenericArguments().Single();
            var expectedCount = mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Length;

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);

            // Verify outcome
            Assert.Equal(expectedCount, result.Count());
            // Teardown
        }
        public void ConstructorsDefineCorrectParameters(Type t)
        {
            // Fixture setup
            var mockType         = t.GetGenericArguments().Single();
            var mockTypeCtorArgs = from ci in mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                   select ci.GetParameters();

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);
            // Verify outcome
            var actualArgs = from ci in result
                             select ci.Parameters;

            Assert.True(mockTypeCtorArgs.All(expectedParams =>
                                             actualArgs.Any(actualParams =>
                                                            expectedParams.SequenceEqual(actualParams))));
            // Teardown
        }
        public void ConstructorsAreReturnedInCorrectOrder(Type t)
        {
            // Fixture setup
            var mockType = t.GetGenericArguments().Single();
            var mockTypeCtorArgCounts = from ci in mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                        let paramCount = ci.GetParameters().Length
                                                         orderby paramCount ascending
                                                         select paramCount;

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);
            // Verify outcome
            var actualArgCounts = from ci in result
                                  select ci.Parameters.Count();

            Assert.True(mockTypeCtorArgCounts.SequenceEqual(actualArgCounts));
            // Teardown
        }
        public void ConstructorsDefineCorrectParameters(Type t)
        {
            // Fixture setup
            var mockType = t.GetGenericArguments().Single();
            var mockTypeCtorArgs = from ci in mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                   select ci.GetParameters();

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);
            // Verify outcome
            var actualArgs = from ci in result
                             select ci.Parameters;
            Assert.True(mockTypeCtorArgs.All(expectedParams =>
                actualArgs.Any(actualParams =>
                    expectedParams.SequenceEqual(actualParams))));
            // Teardown
        }
        public void ConstructorsAreReturnedInCorrectOrder(Type t)
        {
            // Fixture setup
            var mockType = t.GetGenericArguments().Single();
            var mockTypeCtorArgCounts = from ci in mockType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                        let paramCount = ci.GetParameters().Length
                                        orderby paramCount ascending
                                        select paramCount;

            var sut = new MockConstructorQuery();
            // Exercise system
            var result = sut.SelectConstructors(t);
            // Verify outcome
            var actualArgCounts = from ci in result
                                  select ci.Parameters.Count();
            Assert.True(mockTypeCtorArgCounts.SequenceEqual(actualArgCounts));
            // Teardown
        }