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

SessionFake Set Better Mimic DotNet Session Behvaiour #10

Open
MTuffinProgressive opened this issue Sep 25, 2024 · 0 comments
Open

SessionFake Set Better Mimic DotNet Session Behvaiour #10

MTuffinProgressive opened this issue Sep 25, 2024 · 0 comments

Comments

@MTuffinProgressive
Copy link

public void Set(string key, byte[] value) => this.data.Add(key, value);

The dotnet Session when you set again it will just updates the existing dictionary entry

Example:
HttpContext.Session.SetString("TestMe", "TestValue");
HttpContext.Session.SetString("TestMe", "TestValue1");

Value in session with key just gets updated

I created my own session fake and here is the fix if you want to incorporate into the sessionfake here

public void Set(string key, byte[] value)
{
if(this.data.ContainsKey(key))
{
this.data[key] = value;
}
else
{
this.data.Add(key, value);
}
}

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

No branches or pull requests

1 participant