public void SelectNonMethodCallExpressionWithoutReturnThrows() { var sut = new Methods<ClassWithMethods>(); Expression<Action<ClassWithMethods>> nonMethodCallExpression = _ => new object(); Assert.Throws<ArgumentException>( () => sut.Select(nonMethodCallExpression)); }
public void SelectParameterLessReturnsCorrectMethod() { var sut = new Methods<ClassWithMethods>(); MethodInfo actual = sut.Select(x => x.OmitParameters()); var expected = typeof(ClassWithMethods).GetMethod("OmitParameters"); Assert.Equal(expected, actual); }
public void GuardClauses() { IFixture fixture = new Fixture().Customize(new AutoRhinoMockCustomization()); fixture.Customize<Control>(c => c.OmitAutoProperties()); fixture.Customizations.Add(new PointBuilder()); var methods = new Methods<ValuesToolTip>(); var members = new List<MemberInfo>(typeof(ValuesToolTip).GetMembers()); members.Remove(methods.Select(tt => tt.Set(default(string)))); members.Remove(methods.Select(tt => tt.Set(default(string), default(Point)))); fixture.Create<GuardClauseAssertion>() .Verify(members); }
public void SelectNullThrows() { var sut = new Methods<ClassWithMethods>(); Assert.Throws<ArgumentNullException>(() => sut.Select(null)); }
public void SelectNullFuncThrows() { var sut = new Methods<ClassWithMethods>(); Assert.Throws<ArgumentNullException>(() => sut.Select((Expression<Func<ClassWithMethods, object>>)null)); }
public void SelectNonMethodCallExpressionThrows() { var sut = new Methods<ClassWithMethods>(); Assert.Throws<ArgumentException>( () => sut.Select(_ => 1 + 1)); }