Skip to content

how to mock ReadOnlySpan param? #326

@ali50m

Description

@ali50m

I have a generic method like below,

public interface IItemsIndexFetchService
{
    T GetItemByIndex<T>(ReadOnlySpan<T> items, int index);
}

But I have no idea about how to mock the ReadOnlySpan parameter for this method. Could you helpl me out? Thanks!

 _mocker
    .GetMock<IItemsIndexFetchService>()
    .Setup(x => x.GetItemByIndex(It.IsAny<[HOW]>(), It.IsAny<int>()))
    .Returns( [HOW] );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions