Skip to content

How to add ProtectedSessionStorage to Tests? #492

Closed

Description

@newbiE247

In my blazor component i use [Inject] public ProtectedSessionStorage SessionStorage { get; set; }. When testting with bunit it doesn't find implementation of ProtectedSessionStorage and IDataProtectionProvider, since IDataProtectionProvider is injected within ProtectedSessionStorage via contructor.

Typically i would implement services like it's shown here: https://bunit.dev/docs/providing-input/inject-services-into-components.html

But i have no clue how to implement ProtectedSessionStorage.

Activity

  1. Christian-Oleson commented on Sep 9, 2021

    @Christian-Oleson
    Contributor

    Hey @newbiE247 ,

    The link you provided does not take me anywhere. When implementing ProtectedSessionStorage, I would hide the storage behind an interface and then mock the dependency.

  2. locked and limited conversation to collaborators on Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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