コード例 #1
0
        public static TM_QA_Config                  load(this TM_QA_Config_Loader configLoader)
        {
            var localFilePath = configLoader.localFilePath();

            if (localFilePath.fileExists())
            {
                return(localFilePath.load <TM_QA_Config>());
            }
            return(configLoader.create());
        }
コード例 #2
0
        [Test] public void load_create()
        {
            var tmpFolder = "TM_QA_Config".tempDir(false);
            var tmpFile   = 10.randomLetters().append(".txt");

            qaConfigLoader = new TM_QA_Config_Loader(tmpFolder, tmpFile);

            Assert.IsFalse(qaConfigLoader.localFilePath().fileExists());

            qaConfig = qaConfigLoader.create();

            //check values
            Assert.NotNull(qaConfig);
            Assert.IsTrue(qaConfig.Firebase_Site.valid());
            Assert.IsTrue(qaConfig.Firebase_Area.valid());
            Assert.IsTrue(qaConfig.SMTP_Server.valid());
            Assert.IsTrue(qaConfig.SMTP_UserName.valid());
            Assert.IsTrue(qaConfig.Default_Admin_Email.valid());
            Assert.IsTrue(qaConfig.Default_Admin_User.valid());
            Assert.IsTrue(qaConfig.Default_Admin_Pwd.valid());
            Assert.AreEqual(qaConfig.Firebase_AuthToken, "");
            Assert.AreEqual(qaConfig.SMTP_Password, "");
            Assert.NotNull(qaConfig.TestUsers);
            Assert.AreEqual(qaConfig.TestUsers.size(), 3);

            // check that is exists and it is also created using .load()
            var localFilePath = qaConfigLoader.localFilePath();

            Assert.IsTrue(localFilePath.fileExists());
            localFilePath.file_Delete();
            Assert.IsFalse(localFilePath.fileExists());
            Assert.IsNotNull(qaConfigLoader.load());
            Assert.IsTrue(localFilePath.fileExists());

            //delete temp folder
            Assert.IsTrue(tmpFolder.dirExists());
            Assert.IsTrue(Files.deleteFolder(tmpFolder, true));
            Assert.IsFalse(tmpFolder.dirExists());
        }
コード例 #3
0
        public void load_create()
        {
            var tmpFolder = "TM_QA_Config".tempDir(false);
            var tmpFile = 10.randomLetters().append(".txt");

            qaConfigLoader = new TM_QA_Config_Loader(tmpFolder, tmpFile);

            Assert.IsFalse(qaConfigLoader.localFilePath().fileExists());

            qaConfig = qaConfigLoader.create();

            //check values
            Assert.NotNull (qaConfig                             );
            Assert.IsTrue  (qaConfig.Firebase_Site       .valid());
            Assert.IsTrue  (qaConfig.Firebase_Area       .valid());
            Assert.IsTrue  (qaConfig.SMTP_Server         .valid());
            Assert.IsTrue  (qaConfig.SMTP_UserName       .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_Email .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_User  .valid());
            Assert.IsTrue  (qaConfig.Default_Admin_Pwd   .valid());
            Assert.AreEqual(qaConfig.Firebase_AuthToken  , ""    );
            Assert.AreEqual(qaConfig.SMTP_Password       , ""    );
            Assert.NotNull (qaConfig.TestUsers                   );
            Assert.AreEqual(qaConfig.TestUsers.size()    , 3     );

            // check that is exists and it is also created using .load()
            var localFilePath = qaConfigLoader.localFilePath();
            Assert.IsTrue   (localFilePath.fileExists());
            localFilePath.file_Delete();
            Assert.IsFalse  (localFilePath.fileExists());
            Assert.IsNotNull(qaConfigLoader.load());
            Assert.IsTrue   (localFilePath.fileExists());

            //delete temp folder
            Assert.IsTrue  (tmpFolder.dirExists());
            Assert.IsTrue  (Files.deleteFolder(tmpFolder, true));
            Assert.IsFalse(tmpFolder.dirExists());
        }
コード例 #4
0
        [Test] public void localFilePath()
        {
            //check that file exists
            var tmQaConfig_Path = qaConfigLoader.localFilePath();

            tmQaConfig_Path.info();
            Assert.IsNotNull(tmQaConfig_Path);
            Assert.IsTrue(tmQaConfig_Path.fileExists());

            //
            var tmQAConfig2 = tmQaConfig_Path.load <TM_QA_Config>();

            Assert.IsNotNull(tmQAConfig2);
            Assert.IsNotNull(tmQAConfig2.Default_Admin_Email);
            Assert.AreEqual(tmQAConfig2.toXml(), tmQaConfig_Path.load <TM_QA_Config>().toXml());
        }
コード例 #5
0
        public static TM_QA_Config                  create(this TM_QA_Config_Loader configLoader)
        {
            var tmQaConfig = new TM_QA_Config()
            {
                Url_Target_TM_Site  = "http://*****:*****@securityinnovation.com",
                Default_Admin_User  = Tests_Consts.DEFAULT_ADMIN_USERNAME,
                Default_Admin_Pwd   = Tests_Consts.DEFAULT_ADMIN_PASSWORD,
            };

            var targetFile = configLoader.localFilePath();

            targetFile.parentFolder().createDir();              // ensure that is exists

            tmQaConfig.addDefaultTestUsers()
            .saveAs(targetFile);
            return(tmQaConfig);
        }