public void InitManager()
        {
            ApplicationSettings.GetInstance("").DeleteAllParameters();
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
            TechnicalSettings.UseOnlineMode = false;
            //Create Manager
            FundingLineManager fundingLineManager = new FundingLineManager(DataUtil.TESTDB);
            ClientManager clientManagement = new ClientManager(DataUtil.TESTDB);
            ConnectionManager connectionManager = ConnectionManager.GetInstance(DataUtil.TESTDB);
            //Create Service
            EconomicActivityServices economicActivityServices = new EconomicActivityServices(DataUtil.TESTDB);
            ClientServices clientService = new ClientServices(clientManagement);
            FundingLineServices fundingLineService = new FundingLineServices(fundingLineManager, clientManagement);
            ProjectServices projectService = new ProjectServices(DataUtil.TESTDB);

            container = new Hashtable
                            {
                                {"EconomicActivityServices", economicActivityServices},
                                {"ClientServices", clientService},
                                {"FundingLineServices", fundingLineService},
                                {"ProjectServices", projectService},
                                {"ConnectionManager", connectionManager}
                            };
        }
        public void AddEconomicActivityWhenNameAlreadyExist()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = new EconomicActivity { Id = 1 } };

            _dynamicMock.ExpectAndReturn("ThisActivityAlreadyExist", true, "Services", 1);
            _dynamicMock.ExpectAndReturn("AddEconomicActivity", 0, activity);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            _economicActivityServices.AddEconomicActivity(activity);
        }
        public void AddEconomicActivity()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Name = "Services",Parent = new EconomicActivity {Id=1}};

            _dynamicMock.ExpectAndReturn("ThisActivityAlreadyExist", false, "Services", 1);
            _dynamicMock.ExpectAndReturn("AddEconomicActivity", 2, activity);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            activity.Id = _economicActivityServices.AddEconomicActivity(activity);
            Assert.AreEqual(2,activity.Id);
        }
Example #4
0
        public LoanServices(User pUser)
            : base(pUser)
        {
            _user = pUser;
            _loanManager = new LoanManager(pUser);
            _instalmentManager = new InstallmentManager(pUser);
            _clientManager = new ClientManager(pUser, true, true);
            _branchService = new BranchService(pUser);
            _econimcActivityServices = new EconomicActivityServices(pUser);
            _ePs = ServicesProvider.GetInstance().GetEventProcessorServices();
            _accountingServices = new AccountingServices(pUser);
            _fundingLineServices = new FundingLineServices(pUser);
            _savingServices = new SavingServices(pUser);
            _savingEventManager = new SavingEventManager(pUser);

            var settings = ApplicationSettings.GetInstance(string.Empty);
            var nonWorkingDate = NonWorkingDateSingleton.GetInstance(string.Empty);
            _configurationFactory = new OctopusScheduleConfigurationFactory(nonWorkingDate, settings);

            MefContainer.Current.Bind(this);
        }
Example #5
0
 public LoanServices(User pUser)
     : base(pUser)
 {
     _user = pUser;
     _loanManager = new LoanManager(pUser);
     _instalmentManager = new InstallmentManager(pUser);
     _clientManager = new ClientManager(pUser, true, true);
     _branchService = new BranchService(pUser);
     _econimcActivityServices = new EconomicActivityServices(pUser);
     _ePs = ServicesProvider.GetInstance().GetEventProcessorServices();
     _accountingServices = new AccountingServices(pUser);
     _fundingLineServices = new FundingLineServices(pUser);
     _savingServices = new SavingServices(pUser);
     _savingEventManager = new SavingEventManager(pUser);
 }
        public void AddEconomicActivityWhenNameIsEmpty()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Name = String.Empty };

            _dynamicMock.ExpectAndReturn("AddEconomicActivity",0, activity);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            _economicActivityServices.AddEconomicActivity(activity);
        }
        public void UpdateEconomicActivityButNewNameAlreadyExist()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Name = "Services", Parent = new EconomicActivity { Id = 1 } };

            _dynamicMock.Expect("UpdateEconomicActivity", activity);
            _dynamicMock.ExpectAndReturn("ThisActivityAlreadyExist", true, "Services", 1);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            _economicActivityServices.ChangeDomainOfApplicationName(activity, "Services");
        }
        public void TestDeleteDomainWhenDomainHasNoChildrens()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Id = 1, Name = "Services", Childrens = new List<EconomicActivity>()};

            _dynamicMock.Expect("UpdateEconomicActivity",activity);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            _economicActivityServices.DeleteEconomicActivity(activity);
        }
        public void TestChangeDomainOfApplicationNameWhenNotInUse()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activity = new EconomicActivity { Id = 2, Name = "Services",Parent = new EconomicActivity { Id = 1 }};

            _dynamicMock.Expect("UpdateEconomicActivity", activity);
            _dynamicMock.ExpectAndReturn("ThisActivityAlreadyExist", false, "GMO agriculture", 1);
            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);
            Assert.AreEqual(true, _economicActivityServices.ChangeDomainOfApplicationName(activity, "GMO agriculture"));
        }
        public void FindAllEconomicActivitiesWhithoutResult()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            List<EconomicActivity> activities = new List<EconomicActivity> ();

            _dynamicMock.SetReturnValue("SelectAllEconomicActivities", activities);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            Assert.AreEqual(0, _economicActivityServices.FindAllEconomicActivities().Count);
        }
        public void FindAllEconomicActivitiesWhenResult()
        {
            _dynamicMock = new DynamicMock(typeof(EconomicActivityManager));
            EconomicActivity activityA1 = new EconomicActivity { Id = 3, Name = "ServicesA1" };
            EconomicActivity activityB2 = new EconomicActivity { Id = 4, Name = "ServicesB2" };
            EconomicActivity activityA = new EconomicActivity { Id = 1,Name = "ServicesA", Parent = null ,Childrens = new List<EconomicActivity>{activityA1,activityB2}};
            EconomicActivity activityB = new EconomicActivity { Id = 2, Name = "ServicesB", Parent = null };

            List<EconomicActivity> activities = new List<EconomicActivity> {activityA, activityB};

            _dynamicMock.SetReturnValue("SelectAllEconomicActivities", activities);

            _economicActivityManager = (EconomicActivityManager)_dynamicMock.MockInstance;
            _economicActivityServices = new EconomicActivityServices(_economicActivityManager);

            Assert.AreEqual(2, _economicActivityServices.FindAllEconomicActivities().Count);
        }