Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Lambda expression #7

Merged
merged 3 commits into from
Dec 31, 2022
Merged

Fix: Lambda expression #7

merged 3 commits into from
Dec 31, 2022

Conversation

hlaueriksson
Copy link
Owner

Invoking a test fixture member with a lambda expression resulted in a crash:

Message:
  System.ArgumentOutOfRangeException : StartIndex cannot be less than zero. (Parameter 'startIndex')
Stack Trace:
  String.Remove(Int32 startIndex)
  InternalNamingExtensions.GetFunctionName(MethodInfo testFunction, MethodBase testMethod)
  LoFuTest.AssertAsync(Object testFixture, MethodBase testMethod)
  InternalLoFuTestExtensions.AssertAsync(Object fixture, MethodBase method)
  <.ctor>b__0_0(TestExecutionContext context)
  AfterTestCommand.Execute(TestExecutionContext context)
  SimpleWorkItem.PerformWork()

This would for example happen when using FluentAssertions and testing exceptions:

Func<Task> act = () => asyncObject.ThrowAsync<ArgumentException>();
await act.Should().ThrowAsync<InvalidOperationException>();

See https://fluentassertions.com/exceptions/

@hlaueriksson hlaueriksson added the bug Something isn't working label Dec 31, 2022
@hlaueriksson hlaueriksson merged commit 7bab516 into master Dec 31, 2022
@hlaueriksson hlaueriksson deleted the func branch July 14, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant