public void Change_SMTP_network_settings()
        {
            var webConfig = Prepare.WebConfig();
            var runner = new Runner(new Variables());

            runner.ExecScript("DummyFileName", @"
            [smtp]
            host=host1
            port=111
            userName=userName1
            password=password1
            defaultCredentials=false
            ");
            var actualHost = XmlUtil.ReadSmtpNetworkField(webConfig, "host");
            var actualPort = XmlUtil.ReadSmtpNetworkField(webConfig, "port");
            var actualUserName = XmlUtil.ReadSmtpNetworkField(webConfig, "userName");
            var actualPassword = XmlUtil.ReadSmtpNetworkField(webConfig, "password");
            var actualDefaultCredentials = XmlUtil.ReadSmtpNetworkField(webConfig, "defaultCredentials");

            Assert.AreEqual("host1", actualHost);
            Assert.AreEqual("111", actualPort);
            Assert.AreEqual("userName1", actualUserName);
            Assert.AreEqual("password1", actualPassword);
            Assert.AreEqual("false", actualDefaultCredentials);
        }
        public void Define_variable_in_script_and_read_its_value()
        {
            var variables = new Variables();
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", @"
            [define]
            some_var=value
            ");

            Assert.AreEqual("value", variables.Get("some_var"));
        }
        public void Undefined_variable_should_not_have_value()
        {
            var variables = new Variables();
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", @"
            [define]
            some_var=value
            some_var=
            ");
            variables.Get("some_var");
        }
        public void Change_SMTP_node_settings()
        {
            var webConfig = Prepare.WebConfig();
            var runner = new Runner(new Variables());

            runner.ExecScript("DummyFileName", @"
            [smtp]
            from = [email protected]
            ");
            var actualValue = XmlUtil.ReadSmtpField(webConfig, fieldName: "from");

            Assert.AreEqual("*****@*****.**", actualValue);
        }
        public void Set_to_NULL()
        {
            Prepare.Database();
            var variables = new Variables();
            variables.Set(Variables.CONNECTION_STRING, DatabaseUtil.ConnectionString);
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", "[database]\nCustomers[id='11111111-0000-0000-0000-000000000000'].Age = NULL");

            var johnSmithAge = DatabaseUtil.Execute<object>("SELECT TOP 1 age FROM Customers WHERE name ='John Smith'");

            Assert.IsTrue(Convert.IsDBNull(johnSmithAge));
        }
        public void Comments_have_no_effect()
        {
            var variables = new Variables();
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", @"
            [define]
            some_var=value1
            #some_var=value2

            ");
            Assert.AreEqual("value1", variables.Get("some_var"));
        }
        public void Operatorless_filter()
        {
            Prepare.Database();
            var variables = new Variables();
            variables.Set(Variables.CONNECTION_STRING, DatabaseUtil.ConnectionString);
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", "[database]\nCustomers['John Smith'].Age = 80");

            var johnSmithAge = DatabaseUtil.Execute<int?>("SELECT TOP 1 age FROM Customers WHERE name ='John Smith'");

            Assert.AreEqual(80, johnSmithAge);
        }
        public void Change_compilation_attribute()
        {
            var webConfig = Prepare.WebConfig();
            var runner = new Runner(new Variables());

            runner.ExecScript("DummyFileName", @"
            [compilation]
            debug = false
            ");
            var actualValue = XmlUtil.ReadAttribute(webConfig, "/configuration/system.web/compilation", "debug");

            Assert.AreEqual("false", actualValue);
        }
        public void Change_setting()
        {
            var webConfig = Prepare.WebConfig();
            var runner = new Runner(new Variables());

            runner.ExecScript("DummyFileName", @"
            [settings]
            Email.Enable.Ssl = False
            ");
            var actualValue = XmlUtil.ReadSetting(webConfig, "Email.Enable.Ssl");

            Assert.AreEqual("False", actualValue);
        }
        public void External_sql_file()
        {
            Prepare.Database();
            Prepare.Script("setTo90.sql", "UPDATE Customers SET Age=90 WHERE Name='John Smith'");
            var variables = new Variables();
            variables.Set(Variables.CONNECTION_STRING, DatabaseUtil.ConnectionString);
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", "[database]\nExec setTo90.sql");

            var johnSmithAge = DatabaseUtil.Execute<int?>("SELECT TOP 1 age FROM Customers WHERE name ='John Smith'");

            Assert.AreEqual(90, johnSmithAge);
        }
        public void NotEqual_filter()
        {
            Prepare.Database();
            var variables = new Variables();
            variables.Set(Variables.CONNECTION_STRING, DatabaseUtil.ConnectionString);
            var runner = new Runner(variables);

            runner.ExecScript("DummyFileName", "[database]\nCustomers[id<>'11111111-0000-0000-0000-000000000000'].Age = 0");

            var johnDoeAge = DatabaseUtil.Execute<int>("SELECT TOP 1 age FROM Customers WHERE name ='John Doe'");
            var johnSmithAge = DatabaseUtil.Execute<int>("SELECT TOP 1 age FROM Customers WHERE name ='John Smith'");

            Assert.AreEqual(0, johnDoeAge); // must be changed
            Assert.AreEqual(35, johnSmithAge); // must be intact
        }
Exemple #12
0
        public void SMTP_attribute_must_be_created_if_not_exists()
        {
            var webConfig = Prepare.WebConfig();
            var runner = new Runner(new Variables());

            runner.ExecScript("DummyFileName", @"
            [smtp]
            LockItem=false
            EnableSsl=true
            ");
            var actualLockItem = XmlUtil.ReadSmtpField(webConfig, "LockItem");
            var actualEnableSsl = XmlUtil.ReadSmtpNetworkField(webConfig, "EnableSsl");

            Assert.AreEqual("false", actualLockItem);
            Assert.AreEqual("true", actualEnableSsl);
        }
        public void Variables_from_included_script_should_exist()
        {
            var variables = new Variables();
            var runner = new Runner(variables);

            Prepare.Script("common.deploy", @"
            [define]
            some_var=value
            ");

            runner.ExecScript("DummyFileName", @"
            include common.deploy
            ");

            Assert.AreEqual("value", variables.Get("some_var"));
        }