Enhance dictionary safety with SafeGet, SafeSet, and SafeRemove methods. Adjust IWebContext and related tests to support nullable value types in dictionary operations. Refactor GetRequestParameter for clarity and consistency.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using VAR.WebFormsCore.Code;
|
||||
using VAR.WebFormsCore.Pages;
|
||||
using VAR.WebFormsCore.Tests.Fakes;
|
||||
using Xunit;
|
||||
@@ -31,7 +32,7 @@ public class FrmEchoTests
|
||||
public void ProcessRequest__OneQueryParameterGet__FormData()
|
||||
{
|
||||
FakeWebContext fakeWebContext = new();
|
||||
fakeWebContext.RequestQuery.Add("Test", "Value");
|
||||
fakeWebContext.RequestQuery.SafeSet("Test", "Value");
|
||||
FrmEcho frmEcho = new();
|
||||
|
||||
frmEcho.ProcessRequest(fakeWebContext);
|
||||
@@ -53,7 +54,7 @@ public class FrmEchoTests
|
||||
public void ProcessRequest__OneFormParameterPost__FormData()
|
||||
{
|
||||
FakeWebContext fakeWebContext = new(requestMethod: "POST");
|
||||
fakeWebContext.RequestForm.Add("Test", "Value");
|
||||
fakeWebContext.RequestForm.SafeSet("Test", "Value");
|
||||
FrmEcho frmEcho = new();
|
||||
|
||||
frmEcho.ProcessRequest(fakeWebContext);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PageCommonTests
|
||||
(GlobalConfig.Get() as FakeGlobalConfig)?.FakeSetLoginHandler(loginHandler);
|
||||
(GlobalConfig.Get() as FakeGlobalConfig)?.FakeSetAuthenticated(true);
|
||||
FakeWebContext fakeWebContext = new(requestMethod: "POST");
|
||||
fakeWebContext.RequestForm.Add("ctl00_ctl02_btnLogout", "Logout");
|
||||
fakeWebContext.RequestForm.SafeSet("ctl00_ctl02_btnLogout", "Logout");
|
||||
TestEmptyForm testEmptyForm = new(mustBeAuthenticated: true);
|
||||
|
||||
testEmptyForm.ProcessRequest(fakeWebContext);
|
||||
|
||||
Reference in New Issue
Block a user