Skip to content

DefaultValue.Empty and DefaultValue.Mock should support C# 7 tuple return types #562

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

Closed
stakx opened this issue Dec 30, 2017 · 0 comments · Fixed by #563
Closed

DefaultValue.Empty and DefaultValue.Mock should support C# 7 tuple return types #562

stakx opened this issue Dec 30, 2017 · 0 comments · Fixed by #563
Assignees

Comments

@stakx
Copy link
Contributor

stakx commented Dec 30, 2017

C# 7 introduced language syntax for tuples (System.ValueTuple<…>), Moq should probably support them. For example, given these types:

public interface IFoo
{
    (IBar, IEnumerable<string>) GetThings();
}

public interface IBar { }

The following test should pass:

[Fact]
public void DefaultValue_Mock_supports_tuple_return_types()
{
    var mock = new Mock<IFoo>() { DefaultValue.Mock };
    var (bar, strings) = mock.Object.GetThings();

    Assert.NotNull(bar);
    Assert.IsAssignableFrom<IBar>(bar);

    Assert.NotNull(strings);
    Assert.Empty(strings);
}

(Same goes for DefaultValue.Empty.)

@stakx stakx self-assigned this Dec 30, 2017
@devlooped devlooped locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant