Portal signin via Control Instance
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Moq;
|
||||
using Sarand.BusinessMgr.Net.Core.Web.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.App;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
|
||||
using Sarand.BusinessMgr.Web.Control.App;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
|
||||
namespace Sarand.BusinessMgr.Test.Web.Control.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmControlApp_Tester_Base
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Application.
|
||||
private class SbmApplication_Control_Test : SbmApplication_Control
|
||||
{
|
||||
public SbmApplication_Control_Test(IConfiguration configuration, IWebHostEnvironment env) :
|
||||
base(configuration)
|
||||
{
|
||||
InitEnvironment(env);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SbmControlApp_Tester_Base()
|
||||
{
|
||||
// Application.
|
||||
Mock<IConfiguration> mockConfiguration = new Mock<IConfiguration>();
|
||||
Mock<IWebHostEnvironment> mockEnvironment = new Mock<IWebHostEnvironment>();
|
||||
mockEnvironment.Setup(m => m.EnvironmentName).Returns(Environments.Development);
|
||||
mockEnvironment.Setup(m => m.ContentRootPath).Returns(@"D:\Sarand\Projects\Users\AHoward\VS2022\BusinessMgr\Workspace\SaBusinessMgrCoreWebControl");
|
||||
App = new SbmApplication_Control_Test(mockConfiguration.Object, mockEnvironment.Object);
|
||||
|
||||
// Session configuration.
|
||||
SessionContextIdx = App.GetSessionContextIdxs()[0];
|
||||
SessionContext = App.GetSessionContext(SessionContextIdx);
|
||||
Internals = new SbmInternals(GetUserContext(SessionContext));
|
||||
Internals_Control = new SbmInternals_Control();
|
||||
UserContext = GetUserContext(SessionContext);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
protected ushort SessionContextIdx { get; }
|
||||
protected SbmApplication_Control App { get; }
|
||||
protected SbmSessionContext SessionContext { get; }
|
||||
protected ISacsDatabase BusMgrDatabase { get { return App.GetBusMgrDatabase(SessionContext); } }
|
||||
protected SbmInternals Internals { get; }
|
||||
protected SbmInternals_Control Internals_Control { get; }
|
||||
protected SbmUserContext UserContext { get; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// User Context.
|
||||
public static SbmUserContext GetUserContext(SbmSessionContext sessionContext)
|
||||
{
|
||||
SbmUserContext userContext = new SbmUserContext_Web(sessionContext);
|
||||
|
||||
return userContext;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user