Migrate BusinessMgr tests to NUnit

This commit is contained in:
Andy Howard
2026-09-15 10:29:35 +01:00
parent 3f2f8c16ef
commit de07f2120f
16 changed files with 333 additions and 411 deletions
@@ -1,4 +1,3 @@
using DocumentFormat.OpenXml.EMMA;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
@@ -17,11 +16,10 @@ using System;
namespace Sarand.BusinessMgr.Test.Web.Control.App
{
//=======================================================================
public class SbmApplication_Tester_Base : SacsDisposable
{
//-------------------------------------------------------------------
// Application.
// --- Definitions ---
private class SbmApplication_Control_Test : SbmApplication_Control
{
public SbmApplication_Control_Test(IConfiguration configuration, IWebHostEnvironment env) :
@@ -31,11 +29,8 @@ namespace Sarand.BusinessMgr.Test.Web.Control.App
}
}
//-------------------------------------------------------------------
// Data members.
// --- Construction ---
//-------------------------------------------------------------------
// Construction.
protected SbmApplication_Tester_Base()
{
// Application.
@@ -46,8 +41,10 @@ namespace Sarand.BusinessMgr.Test.Web.Control.App
App_Control = new SbmApplication_Control_Test(mockConfiguration.Object, mockEnvironment.Object);
Internals_Control = new SbmInternals_Control();
// Control session data.
//SessionData_Control = new SbmSessionData_Control();
// Control session data, matching the minimal session used by the serialization tests.
SbmcAccountMgr accountMgr = Internals_Control.ControlAccountMgr;
SbmcUserAccount userAccount = accountMgr.GetUserAccountByEmailAddress("andy@sarand.com");
SessionData_Control = new SbmSessionData_Control(null, userAccount);
}
protected override void Dispose(bool disposing)
@@ -58,27 +55,27 @@ namespace Sarand.BusinessMgr.Test.Web.Control.App
}
}
//-------------------------------------------------------------------
// Properties.
// --- Properties ---
protected SbmApplication App { get { return App_Control; } }
protected SbmApplication_Web App_Web { get { return App_Control; } }
protected SbmApplication_Control App_Control { get; }
protected SbmSessionData_Control SessionData_Control { get; private set; }
protected SbmInternals_Control Internals_Control { get; private set; }
// Utilities.
// --- Utilities ---
protected SbmInternals_Control CreateInternalsControl() { return new SbmInternals_Control(); }
//-------------------------------------------------------------------
// Core Instance Console.
// --- Core Instance Console ---
protected SbmCoreInstanceConsole_Control CreateCoreInstanceConsole(String repositoryContext)
{
SbmcRepository repository = Internals_Control.ControlInstanceMgr.GetRepositoryByContext(repositoryContext);
return new SbmCoreInstanceConsole_Control(SessionData_Control, repository);
}
//-------------------------------------------------------------------
// Repositories.
// --- Repositories ---
/// <summary>
/// Retrieve an active repository, randomly selected.
@@ -106,7 +103,6 @@ namespace Sarand.BusinessMgr.Test.Web.Control.App
return Internals_Control.ControlInstanceMgr.GetRepositoryList(prmRepository).First();
}
//-------------------------------------------------------------------
// --- The End ---
}
//=======================================================================
}