public void SelectMethodsFromNullTypeThrows() { // Arrange var sut = new ArrayFavoringConstructorQuery(); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.SelectMethods(null).ToList()); }
public void SelectMethodsFromNullTypeThrows() { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => sut.SelectMethods(null).ToList()); // Teardown }
public void SutIsMethodQuery() { // Arrange // Act var sut = new ArrayFavoringConstructorQuery(); // Assert Assert.IsAssignableFrom <IMethodQuery>(sut); }
public void SutIsMethodQuery() { // Fixture setup // Exercise system var sut = new ArrayFavoringConstructorQuery(); // Verify outcome Assert.IsAssignableFrom<IMethodQuery>(sut); // Teardown }
public void DoesNotReturnConstructorsWithParametersOfEnclosingType() { // Arrange var sut = new ArrayFavoringConstructorQuery(); // Act var result = sut.SelectMethods(typeof(TypeWithCopyConstructorsOnly)); // Assert Assert.Empty(result); }
public void SelectMethodsFromNullTypeThrows() { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.SelectMethods(null).ToList()); // Teardown }
public void SutIsMethodQuery() { // Fixture setup // Exercise system var sut = new ArrayFavoringConstructorQuery(); // Verify outcome Assert.IsAssignableFrom <IMethodQuery>(sut); // Teardown }
public void SelectMethodsFromTypeReturnsFirstMethodThatTakesArrayAsArgument(Type type) { // Arrange var sut = new ArrayFavoringConstructorQuery(); // Act var result = sut.SelectMethods(type); // Assert Assert.Contains(result.First().Parameters, p => p.ParameterType.IsArray); }
public void SelectMethodsFromTypeReturnsFirstMethodThatTakesArrayAsArgument(Type type) { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(result.First().Parameters.Any(p => p.ParameterType.IsArray)); // Teardown }
public void SelectFromTypeWithNoPublicConstructorReturnsCorrectResult() { // Arrange var sut = new ArrayFavoringConstructorQuery(); var typeWithNoPublicConstructors = typeof(AbstractType); // Act var result = sut.SelectMethods(typeWithNoPublicConstructors); // Assert Assert.False(result.Any()); }
public void SelectMethodsFromTypeReturnsFirstMethodThatTakesArrayAsArgument(Type type) { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(result.First().Parameters.Any(p => p.ParameterType.IsArray)); // Teardown }
public void SelectFromTypeWithNoPublicConstructorReturnsCorrectResult() { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); var typeWithNoPublicConstructors = typeof(AbstractType); // Exercise system var result = sut.SelectMethods(typeWithNoPublicConstructors); // Verify outcome Assert.False(result.Any()); // Teardown }
public void SelectFromTypeWithNoPublicConstructorReturnsCorrectResult() { // Fixture setup var sut = new ArrayFavoringConstructorQuery(); var typeWithNoPublicConstructors = typeof(AbstractType); // Exercise system var result = sut.SelectMethods(typeWithNoPublicConstructors); // Verify outcome Assert.False(result.Any()); // Teardown }
public void SelectMethodsFromTypeReturnsAllAppropriateResults(Type type) { // Fixture setup var expectedConstructors = from ci in type.GetConstructors() let parameters = ci.GetParameters() select new ConstructorMethod(ci) as IMethod; var sut = new ArrayFavoringConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(expectedConstructors.All(m => result.Any(m.Equals))); // Teardown }
public void SelectMethodsFromTypeReturnsAllAppropriateResults(Type type) { // Arrange var expectedConstructors = from ci in type.GetConstructors() let parameters = ci.GetParameters() select new ConstructorMethod(ci) as IMethod; var sut = new ArrayFavoringConstructorQuery(); // Act var result = sut.SelectMethods(type); // Assert Assert.True(expectedConstructors.All(m => result.Any(m.Equals))); }
public void SelectMethodsFromTypeReturnsCorrectlyOrderedResultWhenNoConstructorContainsEnumerableArguments(Type type) { // Arrange var expectedConstructors = from ci in type.GetConstructors() let parameters = ci.GetParameters() orderby parameters.Length ascending select new ConstructorMethod(ci) as IMethod; var sut = new ArrayFavoringConstructorQuery(); // Act var result = sut.SelectMethods(type); // Assert Assert.True(expectedConstructors.SequenceEqual(result)); }
public void SelectMethodsFromTypeReturnsAllAppropriateResults(Type type) { // Fixture setup var expectedConstructors = from ci in type.GetConstructors() let parameters = ci.GetParameters() select new ConstructorMethod(ci) as IMethod; var sut = new ArrayFavoringConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(expectedConstructors.All(m => result.Any(m.Equals))); // Teardown }
public void SelectMethodsFromTypeReturnsCorrectlyOrderedResultWhenNoConstructorContainsEnumerableArguments(Type type) { // Fixture setup var expectedConstructors = from ci in type.GetConstructors() let parameters = ci.GetParameters() orderby parameters.Length ascending select new ConstructorMethod(ci) as IMethod; var sut = new ArrayFavoringConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(expectedConstructors.SequenceEqual(result)); // Teardown }