Skip to content

IPnPContextFactory >> PnPContext #1570

Open
@freddieontheweb

Description

Category

  • Bug

Describe the bug

The IPnPContextFactory interface has create methods returning concretions and, as discussed elsewhere, PnPContext only has internal constructors meaning that setting up responses for Create calls is problematic.

Steps to reproduce

For example, the following snippet will fail:

// some code

_contextFactory.Setup(x =>
        x.CreateAsync(new Uri(SharepointBaseUri), new WrappedTokenProvider(SharepointToken), null))
    .Returns(Task.FromResult(ctx.Object));

// some code

Expected behavior

As PnPContext implements the IPnPContext interface, I would expect the Create method calls on IPnPContextFactory to return abstractions and not concretions thereby allowing for unit testing of code consuming these classes.

Metadata

Assignees

No one assigned

    Labels

    area: framework ⚙Changes in the SDK core framework codequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions