using Sarand.BusinessMgr.Net.Standard.Base.App; using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control; using Sarand.BusinessMgr.Net.Standard.Base.Consoles; using Sarand.BusinessMgr.Web.Control.Consoles; using Sarand.Net.Standard.Base.Core; using Sarand.Net.Standard.Base.Dbas; using Sarand.Net.Standard.Base.Security; namespace Sarand.BusinessMgr.Test.Web.Control.App { //======================================================================= [TestClass] public class SbmApplication_Tester : SbmApplication_Tester_Base { //------------------------------------------------------------------- [TestMethod] public void Test_Application_Application() { // Application. Assert.IsNotNull(App); Assert.IsNotNull(App_Web); Assert.IsNotNull(App_Control); } //------------------------------------------------------------------- [TestMethod] public void Test_Application_ControlDatabase() { // Control database. ISacsDatabase db = App.GetControlDatabase(); Assert.IsNotNull(db); // Tables. Assert.IsTrue(db.TableExists(SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.Owner))); Assert.IsTrue(db.TableExists(SbmDbDfn_Control.GetTableName(SbmDbDfn_Control.TableIdx.Repository))); } //------------------------------------------------------------------- [TestMethod] public void Test_Application_TemplateDatabase() { // Template database. ISacsDatabase db = App.GetTemplateDatabase(); Assert.IsNotNull(db); // Tables. Assert.IsTrue(db.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Affiliate))); Assert.IsTrue(db.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Commodity))); Assert.IsTrue(db.TableExists(SbmDbDfn.GetTableName(SbmDbDfn.TableIdx.Transaction, false))); Assert.IsTrue(db.TableExists(SaSecurityDbDfn.GetTableName(SaSecurityDbDfn.TableIdx.SaSecItem))); } //------------------------------------------------------------------- [TestMethod] public void Test_Application_Internals_Control() { // Record disposable items as they are created so all can be disposed when needed. using (DisposableCollection disposables = new DisposableCollection()) { // Control internals. Assert.IsNotNull(Internals_Control); // Owners. Assert.IsNotNull(Internals_Control.ControlInstanceMgr); SbmcOwner.Params prmOwner = new SbmcOwner.Params(); prmOwner.StatusCat = SbmcOwner.StatusCat.ActiveOnly; Assert.IsTrue(Internals_Control.ControlInstanceMgr.GetOwnerCount(prmOwner) > 0); // Repositories. Assert.IsNotNull(Internals_Control.ControlInstanceMgr); SbmcRepository.Params prmRepository = new SbmcRepository.Params(); prmRepository.StatusCat = SbmcRepository.StatusCat.ActiveOnly; Assert.IsTrue(Internals_Control.ControlInstanceMgr.GetRepositoryCount(prmRepository) > 0); } } //------------------------------------------------------------------- [TestMethod] public void Test_Application_CoreInstanceConsole() { // Record disposable items as they are created so all can be disposed when needed. using (DisposableCollection disposables = new DisposableCollection()) { // Repository. SbmcRepository repository = GetRandomActiveRepository(); Assert.IsNotNull(repository); // Instance console. SbmCoreInstanceConsole instanceConsole = new SbmCoreInstanceConsole_Control(SessionData_Control, repository); disposables.Add(instanceConsole); Assert.IsNotNull(instanceConsole); } } //------------------------------------------------------------------- [TestMethod] public void Test_Application_Internals_Core() { // Record disposable items as they are created so all can be disposed when needed. using (DisposableCollection disposables = new DisposableCollection()) { // Repository. SbmcRepository repository = GetRandomActiveRepository(); Assert.IsNotNull(repository); // Instance console. SbmCoreInstanceConsole instanceConsole = new SbmCoreInstanceConsole_Control(SessionData_Control, repository); disposables.Add(instanceConsole); Assert.IsNotNull(instanceConsole); } } //------------------------------------------------------------------- [TestMethod] public void Test_Application_SessionContexts() { // Record disposable items as they are created so all can be disposed when needed. using (DisposableCollection disposables = new DisposableCollection()) { // Repository. SbmcRepository repository = GetRandomActiveRepository(); Assert.IsNotNull(repository); SbmCoreInstanceConsole instanceConsole = new SbmCoreInstanceConsole_Control(SessionData_Control, repository); disposables.Add(instanceConsole); Assert.IsNotNull(instanceConsole); // Session Context. ushort sessionIdx = App_Control.GetCoreSessionIndexForControlRepository(repository.Id); SbmSessionContext sessionContext = App_Control.GetSessionContextByIndex(sessionIdx); Assert.IsNotNull(sessionContext); Assert.AreEqual(sessionIdx, sessionContext.Index); } } //------------------------------------------------------------------- } //======================================================================= }