Beispiel #1
0
        public void FindAll_CanReturnAllServiceApps()
        {
            IAppListDao dao  = DaoFactory.Create <IAppListDao, AppListDao>(xml);
            var         apps = dao.FindAll();

            Assert.AreEqual(2, apps.Count());
        }
Beispiel #2
0
 /// <summary>
 /// Stops the service apps.
 /// </summary>
 private void StopServiceApps()
 {
     using (IServiceAppDao serviceAppDao = DaoFactory.Create <IServiceAppDao, ServiceAppDao>())
     {
         _appManager.StopAllServiceApps(serviceAppDao, true);
     }
 }
        public async Task <HttpResponseMessage> Create([FromBody] DtoCustomer cust)
        {
            _logger.Debug("Web api : creating customer!");
            using (var custService = new CustomerService(DbContextFactory.Create()))
            {
                var entity = DaoFactory.Create <Angular2.Mvc.Core.Models.DTO.DtoCustomer, Angular2.Mvc.DAL.Models.DAO.Customer>(cust);
                custService.Add(entity);
            }

            return(new HttpResponseMessage(HttpStatusCode.Created));
        }
Beispiel #4
0
        public void FindAll_CanReturnServiceAppByName()
        {
            IAppListDao dao = DaoFactory.Create <IAppListDao, AppListDao>(xml);
            var         app = dao.FindAll(a => a.Name == "TestApp1").FirstOrDefault();

            Assert.AreEqual("TestApp1", app.Name);
            Assert.AreEqual("Shows how SACS works", app.Description);
            Assert.AreEqual("Development", app.Environment);
            Assert.AreEqual(@"E:\Development\SACS\Tests\SACS.TestApp\bin\Debug\SACS.TestApp.exe", app.AppFilePath);
            Assert.AreEqual(StartupType.Automatic, app.StartupTypeEnum);
            Assert.AreEqual("* * * * *", app.Schedule);
            Assert.AreEqual("", app.Username);
            Assert.AreEqual("", app.Password);
        }
Beispiel #5
0
        public IActionResult Create([FromForm] VmCustomer viewModel)
        {
            ViewBag.Title = "Customer - Create";

            if (!ModelState.IsValid)
            {
                TempData["Error"] = "Model validation fail";
                return(RedirectToAction("Index", controllerName: "CustomerMvc"));
            }

            using (var custService = new CustomerService(DbContextFactory.Create()))
            {
                var entity = DaoFactory.Create <VmCustomer, Angular2.Mvc.DAL.Models.DAO.Customer>(viewModel);
                custService.Add(entity);
            }
            return(RedirectToAction("Index", controllerName: "CustomerMvc"));
        }
Beispiel #6
0
        /// <summary>
        /// Loads and schedules the service apps.
        /// </summary>
        private void StartServiceApps()
        {
            // load all the services into the container
            IList <string> errors = new List <string>();

            // TODO: inject via abstract factory
            using (IServiceAppDao serviceAppDao = DaoFactory.Create <IServiceAppDao, ServiceAppDao>())
            {
                IAppListDao appListDao = DaoFactory.Create <IAppListDao, AppListDao>();
                this._appManager.InitializeAllServiceApps(appListDao.FindAll(), serviceAppDao, errors);
            }

            errors.ToList().ForEach(error =>
            {
                this._log.Warn(error);
            });
        }
        static void  Main(string[] args)
        {
            try
            {
                ITextGeneratorHelper textGeneratorHelper = new TextGeneratorHelper();
                IDao           dao           = DaoFactory.Create(eDaoType.FileDao);
                IAnagramFinder anagramFinder = new AnagramFinderByHash();

                AnagramConsoleExecutor anagramExecutor = new AnagramConsoleExecutor(textGeneratorHelper, dao, anagramFinder);

                Task.Run(async() => await anagramExecutor.Run()).Wait();
            }
            catch (Exception e)
            {
                Console.WriteLine(UiMessages.ErrorMsg);
                Console.WriteLine(e.Message);
            }

            Console.ReadKey();
        }
Beispiel #8
0
        public void PersistServiceApp_CanAddUserNameAndPassword()
        {
            IAppListDao dao = DaoFactory.Create <IAppListDao, AppListDao>(xml);
            ServiceApp  app = new ServiceApp
            {
                Name            = "TestApp1",
                Description     = "Shows how SACS works",
                Environment     = "Development",
                AppFilePath     = @"E:\Development\SACS\Tests\SACS.TestApp\bin\Debug\SACS.TestApp.exe",
                StartupTypeEnum = StartupType.Automatic,
                Schedule        = "* * * * *",
                Username        = "******",
                Password        = "******"
            };

            dao.PersistServiceApp(app);

            ServiceApp savedApp = dao.FindAll(sa => sa.Name == "TestApp1").FirstOrDefault();

            Assert.AreEqual("NewUsername", savedApp.Username);
            Assert.AreEqual("NewPassword", savedApp.Password);
        }