Skip to content

Is it possible to mock ServicePartitionLists? #172

Answered by loekd
isakengstrom asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for your question.
You can use reflection to create an instance of ServicePartitionList.

This might work:

    public interface IServicePartitionInformationProvider
    {
        Task<ServicePartitionList> GetServicePartitionList(Uri serviceUri);

        Task<List<ServicePartitionInformation>> GetServicePartitionInformationList(Uri serviceUri);
    }

    public class MockServicePartitionInformationProvider : IServicePartitionInformationProvider
    {
        private readonly IList<Partition> _partitions;

        public MockServicePartitionInformationProvider(params Partition[] partitions)
        {
            if (partitions is null)
            {
                throw new Ar…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by isakengstrom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants