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

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

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant