public void SelectMethodsFromNullTypeThrows() { // Arrange var sut = new ModestConstructorQuery(); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.SelectMethods(null)); }
public void SelectMethodsFromNullTypeThrows() { // Fixture setup var sut = new ModestConstructorQuery(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.SelectMethods(null)); // Teardown }
public void DoesNotReturnConstructorsWithParametersOfEnclosingType() { // Arrange var sut = new ModestConstructorQuery(); // Act var result = sut.SelectMethods(typeof(TypeWithCopyConstructorsOnly)); // Assert Assert.Empty(result); }
public void SelectMethodsFromTypeWithNoPublicConstructorReturnsCorrectResult() { // Arrange var sut = new ModestConstructorQuery(); var typeWithNoPublicConstructors = typeof(AbstractType); // Act var result = sut.SelectMethods(typeWithNoPublicConstructors); // Assert Assert.False(result.Any()); }
public void SelectMethodsFromTypeWithNoPublicConstructorReturnsCorrectResult() { // Fixture setup var sut = new ModestConstructorQuery(); var typeWithNoPublicConstructors = typeof(AbstractType); // Exercise system var result = sut.SelectMethods(typeWithNoPublicConstructors); // Verify outcome Assert.False(result.Any()); // Teardown }
public void SelectMethodsFromTypeReturnsCorrectResult(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 ModestConstructorQuery(); // Act var result = sut.SelectMethods(type); // Assert Assert.True(expectedConstructors.SequenceEqual(result)); }
public void SelectMethodsFromTypeReturnsCorrectResult(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 ModestConstructorQuery(); // Exercise system var result = sut.SelectMethods(type); // Verify outcome Assert.True(expectedConstructors.SequenceEqual(result)); // Teardown }