Inheritance: MonoBehaviour
        public void TestDispose() {
            var variables = new VariableController();

            variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "VolatileKey",
                    "value"
                })
            });

            variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSetA,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "ArchiveKey",
                    "value"
                })
            });

            VariableModel volatileVariable = variables.VolatileVariables.Values.First();

            variables.Dispose();

            // Test that all the lists and data within each item has been nulled.
            Assert.IsNull(variables.VolatileVariables);

            Assert.IsNull(volatileVariable.Name);
            Assert.IsNull(volatileVariable.Value);
        }
        protected void CrearVariable_Click(object sender, EventArgs e)
        {
            if (!validar(nombreVariable.Value.ToString()) || !validar(descripcionNuevaVariable.Value.ToString()))
            {
                msj = "Valide los campos";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
                return;
            }

            VariableController obj = new VariableController(nombreVariable.Value.ToString(), tDato.Value,
                                                            descripcionNuevaVariable.Value.ToString());

            if (obj.Registrar())
            {
                msj = "Exitoso";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
                if (Session["pk_pro"] != null && proyecto.SelectedIndex >= 0)
                {
                    cargarVariables(Session["pk_pro"].ToString());
                }
            }
            else
            {
                msj = "Error al registrar";
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "Confirm();", true);
            }
        }
Beispiel #3
0
        public static VariableController SetPath(this VariableController variableController, string key, string path)
        {
            var controller = variableController;

            controller.SetVariable(key, path.GetType(), path, TypeOfAccess.Global);
            return(controller);
        }
        public static DatabaseController OpenSqLiteDriver(String @namespace = "") {
            var variables = new VariableController();

            var database = new DatabaseController() {
                Shared = {
                    Variables = variables
                }
            }.Execute() as DatabaseController;

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, VariableModel.NamespaceVariableName(@namespace, CommonVariableNames.DatabaseDriverName), "SQLite");

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, VariableModel.NamespaceVariableName(@namespace, CommonVariableNames.DatabaseMemory), true);

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, CommonVariableNames.DatabaseConfigGroups, new List<String>() {
                @namespace
            });

            return database;
        }
Beispiel #5
0
        public RequestDto(IEnumerable <Header> headers, VariableController variableController)
        {
            this.headers            = headers;
            this.variableController = variableController;

            Header = SetData(HeaderType.HEADER);
            Query  = SetData(HeaderType.QUERY);

            if (headers.CheckParameter(HeaderType.CREDENTIAL))
            {
                Credentials = GetCredentials();
            }

            if (headers.CheckParameter(HeaderType.TIMEOUT))
            {
                Timeout = GetTimeout();
            }

            if (headers.CheckParameter(HeaderType.BODY))
            {
                var body = GetBody();
                var obj  = body.GetObject();
                Content = obj.GetHttpContent(body);
            }
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VariableTests"/> class.
 /// Инициализация переменных.
 /// </summary>
 public VariableTests()
 {
     this.variableContext = new VariableController();
     this.variableContext.SetVariable("first", typeof(string), "1");
     this.variableContext.SetVariable("second", typeof(string), "2");
     this.variableContext.SetVariable("third", typeof(string), "3");
 }
Beispiel #7
0
        public static string getSelectVariable(string Name, string Value)
        {
            var    variablename = VariableController.GetByName(Name);
            string html         = "";

            if (variablename != null)
            {
                html += "<select name='ddlVariableValue' id='ddlVariableValue' data-name-id='" + variablename.ID + "' data-name-text='" + variablename.VariableName + "' class='form-control' onchange='changeVariable($(this))'>";
                html += "<option data-sku-text='' value=''>Chọn giá trị</option>";
                var variablevalue = VariableValueController.GetByVariableID(variablename.ID);
                foreach (var p in variablevalue)
                {
                    if (p.VariableValue == Value)
                    {
                        html += "<option data-sku-text='" + p.SKUText + "' selected='selected' value='" + p.ID + "'>" + p.VariableValue + "</option>";
                    }
                    else
                    {
                        html += "<option data-sku-text='" + p.SKUText + "' value='" + p.ID + "'>" + p.VariableValue + "</option>";
                    }
                }
                html += "</select>";
            }
            return(html);
        }
Beispiel #8
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string username = Request.Cookies["usernameLoginSystem"].Value;
            var    acc      = AccountController.GetByUsername(username);

            if (acc != null)
            {
                if (acc.RoleID == 0)
                {
                    string phone     = txtCustomerName.Text.ToLower().Trim();
                    var    checkname = VariableController.GetByName(phone);
                    if (checkname != null)
                    {
                        lblError.Text    = "Tên danh mục đã tồn tại vui lòng chọn tên khác.";
                        lblError.Visible = true;
                    }
                    else
                    {
                        lblError.Visible = false;
                        VariableController.Insert(txtCustomerName.Text, "", chkIsHidden.Checked, DateTime.Now, username);
                        PJUtils.ShowMessageBoxSwAlert("Tạo mới thành công", "s", true, Page);
                    }
                }
            }
        }
 private void Awake()
 {
     m_Character = GetComponent<PlatformerCharacter2D>();
     variables = GameObject.Find("Variables").GetComponent<VariableController>();
     DontDestroyOnLoad(gameObject);
     pose = false;
 }
Beispiel #10
0
 // Use this for initialization
 private void Start()
 {
     //warning = GameObject.Find("Warning").GetComponent<Renderer>().material.color;
     variables = GameObject.Find("Variables").GetComponent<VariableController>();
     cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
     DontDestroyOnLoad(gameObject);
 }
Beispiel #11
0
        /// <summary>
        /// Khởi tạo HTML danh mục biến thể
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Value"></param>
        /// <returns>HTM DropDownList</returns>
        private string _getSelectVariable(string Name, string Value)
        {
            var variableName = VariableController.GetByName(Name);
            var html         = new StringBuilder();

            if (variableName != null)
            {
                html.AppendLine("<select name='ddlVariableValue'");
                html.AppendLine("        class='form-control select2'");
                html.AppendLine("        style='width: 100%'");
                html.AppendLine(String.Format("        data-name-id='{0}'", variableName.ID));
                html.AppendLine(String.Format("        data-name-text='{0}'", variableName.VariableName));
                html.AppendLine("        onchange='onChangeVariationValue($(this))'");
                html.AppendLine(">");
                html.AppendLine("    <option data-sku-text='' value=''>Chọn giá trị</option>");
                var variableValue = VariableValueController.GetByVariableID(variableName.ID);
                foreach (var item in variableValue)
                {
                    var isSelected = item.VariableValue == Value;
                    html.AppendLine(String.Format("    <option data-sku-text='{0}' value='{1}' {2}>{3}</option>", item.SKUText, item.ID, (isSelected ? "selected='selected'" : String.Empty), item.VariableValue));
                }
                html.AppendLine("</select>");
            }
            return(html.ToString());
        }
Beispiel #12
0
        public void TestPackageGroupSetupOrderReversed() {
            var variables = new VariableController();

            var @namespace = "";

            var packages = new PackagesController() {
                Shared = {
                    Variables = variables
                }
            }.Execute() as PackagesController;

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, CommonVariableNames.PackagesConfigGroups, new List<String>() {
                @namespace
            });

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, VariableModel.NamespaceVariableName(@namespace, CommonVariableNames.PackagesRepositoryUri), "path-to-repository");

            Assert.IsNotEmpty(packages.Cache.Repositories);
            Assert.AreEqual("path-to-repository", packages.Cache.Repositories.FirstOrDefault().Uri);
        }
Beispiel #13
0
        public static void BeforeFeature(VariableController variableController)
        {
            TreePages.SetVariables(variableController);
            TreePages.Get();
            var pageObject = TreePages.Get();

            Log.Logger().LogDebug(pageObject.PageObjectToString());
        }
 void Awake()
 {
     variables = GameObject.Find("Variables").GetComponent<VariableController>();
     attackTrigger = GameObject.Find("AttackTrigger").GetComponent<Collider2D>();
     orig = GetComponent<SpriteRenderer>().color;
     playerCollider = GetComponent<Collider2D>();
     aSource = GetComponent<AudioSource>();
 }
Beispiel #15
0
        public static void IsEnumerable(this string collectionNameIndex, VariableController variableController)
        {
            var collectionName = collectionNameIndex.Split("[").First();
            var collection     = variableController.GetVariableValue(collectionName);

            collection.Should().NotBeNull($"Значения в переменной \"{collectionName}\" нет");
            (collection is IEnumerable).Should().BeTrue($"\"{collectionName}\" не является коллекцией");
        }
Beispiel #16
0
        public static void IsDictionary(this string dictionaryNameKey, VariableController variableController)
        {
            var dictionaryName = dictionaryNameKey.Split("[").First();
            var dictionary     = variableController.GetVariableValue(dictionaryName);

            dictionary.Should().NotBeNull($"Значения в переменной \"{dictionaryName}\" нет");
            (dictionary is Dictionary <string, object>).Should().BeTrue($"\"{dictionaryName}\" не является словарем");
        }
Beispiel #17
0
        public void TestValue() {
            var variables = new VariableController();

            ICommandResult result = variables.Tunnel(CommandBuilder.VariablesSet("key", "value").SetOrigin(CommandOrigin.Local));

            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("value", variables.Get("key", String.Empty));
        }
Beispiel #18
0
        public static void RemoveDirectories(VariableController variableController)
        {
            var userDir = variableController.GetVariableValueText(Infrastructures.Constants.USER_DIR);

            if (Directory.Exists(userDir))
            {
                Directory.Delete(userDir, true);
            }
        }
Beispiel #19
0
        public static void BeforeFeature(FeatureContext featureContext, VariableController variableController)
        {
            ConfigurationExtension.Instance.Configuration = ConfigurationExtension.Instance.Configuration ?? ConfigurationFactory.Create(BinDirectory);
            config.Value = ConfigOptionsFactory.Create(ConfigurationExtension.Instance.Configuration);

            var tags = TagHelper.GetTagsBy(featureContext);

            variableController.AddConfig(config.Value, tags);
        }
Beispiel #20
0
 public SqlServerStepTests()
 {
     dbConnectionParams = new SqlConnectionStringBuilder()
     {
         DataSource = "Test", InitialCatalog = "test", UserID = "test", Password = "******", ConnectTimeout = 1, ConnectRetryCount = 0, ConnectRetryInterval = 1
     };
     databaseController = new DatabaseController();
     variableController = new VariableController();
     step = new SqlServerSteps(databaseController, variableController);
 }
Beispiel #21
0
        public void TestEmptyKeyValue() {
            var variables = new VariableController();

            // Set an archive variable
            ICommandResult result = variables.Tunnel(CommandBuilder.VariablesSetF(String.Empty, "value").SetOrigin(CommandOrigin.Local));

            // Validate that the command failed
            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.InvalidParameter, result.CommandResultType);
        }
 public SqlServerStepTests()
 {
     dbConnectionParams = new DbConnectionParams()
     {
         Database = "Test", Source = "test", Login = "******", Password = "******", Timeout = 1, ConnectRetryCount = 0, ConnectRetryInterval = 1
     };
     databaseController = new DatabaseController();
     variableController = new VariableController();
     step = new SqlServerSteps(databaseController, variableController);
 }
Beispiel #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VariableTests"/> class.
        /// Инициализация переменных.
        /// </summary>
        public VariableTests()
        {
            this.variableContext = new VariableController();
            this.variableContext.SetVariable("first", typeof(string), "1");
            this.variableContext.SetVariable("second", typeof(string), "2");
            this.variableContext.SetVariable("third", typeof(string), "3");
            var token = JToken.Parse("{\"first\":1,\"list\":[{\"second\":2},{\"third\":3}],\"four\":\"4\"}");

            this.variableContext.SetVariable("token", token.GetType(), token);
        }
Beispiel #24
0
        public void TestCommonNameValue() {
            var variables = new VariableController();

            // Set an archive variable
            variables.Tunnel(CommandBuilder.VariablesSetF(CommonVariableNames.MaximumProtocolConnections, "value").SetOrigin(CommandOrigin.Local));

            // Validate that the command was successful and the key was set to the passed value.
            Assert.AreEqual("value", variables.Get(CommonVariableNames.MaximumProtocolConnections, String.Empty));
            Assert.AreEqual("value", variables.FlashVariables.Values.First(v => v.Name == CommonVariableNames.MaximumProtocolConnections.ToString()).ToType<String>());
        }
        public static SpecFlowContext Copy(this SpecFlowContext specflowContext, VariableController variableController)
        {
            var context = specflowContext;

            foreach (var(key, value) in variableController.Variables)
            {
                context.Add(key, value);
            }
            return(context);
        }
Beispiel #26
0
        public void TestEmptyValueWithDefault() {
            var variables = new VariableController();

            variables.VolatileVariables.TryAdd("key", new VariableModel() {
                Name = "key",
                Value = ""
            });

            Assert.AreEqual(10, variables.VolatileVariables.Values.First().ToType(10));
        }
Beispiel #27
0
        public void TestPotatoCommandScopeNoScope() {
            var variables = new VariableController();

            var instance = (PotatoController)new PotatoController() {
                Shared = {
                    Variables = variables,
                    Security = new SecurityController(),
                    Events = new EventsController(),
                    Languages = new LanguageController()
                }
            }.Execute();

            ((ProtocolController)instance.Protocols).Protocols.Add(new ProtocolAssemblyMetadata() {
                Directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory),
                Assembly = new FileInfo("MockProtocol.dll"),
                ProtocolTypes = new List<IProtocolType>() {
                    new ProtocolType() {
                        Name = "Mock Protocol",
                        Provider = "Myrcon",
                        Type = "MockProtocol"
                    }
                }
            });

            instance.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.PotatoAddConnection,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "Myrcon",
                    "MockProtocol",
                    "1.1.1.1",
                    27516,
                    "password",
                    ""
                })
            });

            // Tests that there is at least one connection.
            Assert.AreEqual(1, instance.Connections.Count);

            ICommandResult result = instance.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "key",
                    "value"
                })
            });

            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("value", variables.Get("key", "default value"));

            instance.Dispose();
        }
        public static IEnumerable <object> ToEnumerable(this Table table, VariableController variableController)
        {
            var enumerable = new List <object>();

            table.Rows.ToList().Count.Should().Be(0, "Table must have only 1 row: Values");
            foreach (var value in table.Header.ToList())
            {
                enumerable.Add(variableController.ReplaceVariables(value) ?? value);
            }
            return(enumerable);
        }
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(gameObject);
     music = GetComponent<AudioSource>();
     Invoke("FadeIn", 5.0f);
     woodsPlay = true;
     fanfarePlay = true;
     if (Application.loadedLevel == 1) {
         variables = GameObject.Find("Variables").GetComponent<VariableController>();
     }
 }
Beispiel #30
0
    //private int even = 6;
    // Use this for initialization
    private void Start()
    {
        timer = GameObject.Find ("Timer").GetComponent<Timer> ();
        sound = gameObject.GetComponent<AudioSource>();
        variables = GameObject.Find("Variables").GetComponent<VariableController>();
        speed = variables.projectileSpeed;
        character = Camera.main.transform;
        objTrans = gameObject.transform;

        gameObject.transform.localEulerAngles = new Vector3 (340.7f, 189.5f, 266.3f);
    }
Beispiel #31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReplaceTests"/> class.
        /// Инициализация переменных.
        /// </summary>
        public ReplaceTests()
        {
            var obj = ReplaceMethods.Get() as List <Type>;

            if (!obj.Contains(typeof(GenerationFunctions)))
            {
                (ReplaceMethods.Get() as List <Type>).Add(typeof(GenerationFunctions));
            }

            variableContext = new VariableController();
        }
Beispiel #32
0
        public void TestInsufficientPermission() {
            var variables = new VariableController();

            ICommandResult result = variables.Tunnel(CommandBuilder.VariablesSetF("key", "value").SetAuthentication(new CommandAuthenticationModel() {
                Username = "******"
            }).SetOrigin(CommandOrigin.Remote));

            // Validate the command failed because we don't have permissions to execute it.
            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.InsufficientPermissions, result.CommandResultType);
        }
Beispiel #33
0
        public void TestValue() {
            var variables = new VariableController();

            // Set an archive variable
            ICommandResult result = variables.Tunnel(CommandBuilder.VariablesSetF("key", "value").SetOrigin(CommandOrigin.Local));

            // Validate that the command was successful and the key was set to the passed value.
            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("value", variables.Get("key", String.Empty));
            Assert.AreEqual("value", variables.FlashVariables.Values.First(v => v.Name == "key").ToType<String>());
        }
        public Hooks(VariableController variableController,
                     FeatureContext featureContext, ScenarioContext scenarioContext)
        {
            this.variableController = variableController;
            this.featureContext     = featureContext;
            this.scenarioContext    = scenarioContext;

            BinDirectory.Create();
            var configuration = ConfigurationFactory.Create(BinDirectory);

            config.Value = ConfigOptionsFactory.Create(configuration);
        }
Beispiel #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceSteps"/> class.
 /// Привязка шагов работы с с web сервисами к работе с переменным через контекст.
 /// </summary>
 /// <param name="variableController">Контекст для работы с переменными.</param>
 /// <param name="serviceContext">Контекст для работы с web сервисами.</param>
 public ServiceSteps(VariableController variableController, ServiceController serviceController)
 {
     this.variableController = variableController;
     this.serviceController  = serviceController;
     webMethods = new Dictionary <HTTPMethodType, HttpMethod>()
     {
         { HTTPMethodType.GET, HttpMethod.Get },
         { HTTPMethodType.PUT, HttpMethod.Put },
         { HTTPMethodType.POST, HttpMethod.Post },
         { HTTPMethodType.DELETE, HttpMethod.Delete },
         { HTTPMethodType.HEAD, HttpMethod.Head }
     };
 }
Beispiel #36
0
 public ServiceStepTests()
 {
     serviceController  = new ServiceController();
     variableController = new VariableController();
     step        = new ServiceSteps(variableController, serviceController);
     requestInfo = new RequestInfo()
     {
         Url = "http://test", Method = HttpMethod.Get, Headers = new Dictionary <string, string>()
         {
             { "Content-type", "application/json" }
         }, Content = new StringContent("test")
     };
 }
Beispiel #37
0
        public static VariableController AddSettings(this VariableController variableController)
        {
            var controller = variableController;

            var fields = SettingHelper.GetAllFields(typeof(DefaultSetting));

            foreach (var field in fields)
            {
                controller.SetVariable(field.Name, field.GetType(), field.GetValue(null), Molder.Infrastructures.TypeOfAccess.Default);
            }

            return(controller);
        }
 // Use this for initialization
 void Start()
 {
     variables = GameObject.Find("Variables").GetComponent<VariableController>();
     if (Application.loadedLevel == 1) {
         text.text = "";
         StartCoroutine(TypeText());
         controls = "Attack - Space \nDefend - Shift \nMove using either the WASD keys or the Arrow keys.";
         steps = new bool[4];
         for (int i = 0; i < steps.Length; i++) {
             steps[i] = false;
         }
         steps[0] = true;
     }
 }
        public static Dictionary <string, object> ToDictionary(this Table table, VariableController variableController)
        {
            var enumerable = new Dictionary <string, object>();
            var keys       = table.Header.ToList();

            table.Rows.ToList().Count.Should().Be(1, "Table must have only 2 rows: Keys and Values");
            var values = table.Rows.ToList()[0];

            for (var i = 0; i < keys.Count; i++)
            {
                enumerable.Add(variableController.ReplaceVariables(keys[i]) ?? keys[i], variableController.ReplaceVariables(values[i]) ?? values[i]);
            }
            return(enumerable);
        }
        /// <summary>
        ///     Tests that setting the variables in a random order will still setup the push end points correctly.
        /// </summary>
        /// <param name="seed">A random number shouldn't be passed in, otherwise you won't be able to duplicate the results.</param>
        protected void TestEventsPushControllerMultipleEndPointsRandomVariableAssignment(int seed) {
            String pushConfigGroupNameOne = StringExtensions.RandomString(10);
            String pushConfigGroupNameTwo = StringExtensions.RandomString(10);

            var variables = new VariableController();

            var events = new EventsController();

            var pushEvents = (PushEventsController)new PushEventsController() {
                Shared = {
                    Variables = variables,
                    Events = events
                }
            }.Execute();

            var groupVariables = new Dictionary<String, Object>() {
                {CommonVariableNames.EventsPushConfigGroups.ToString(), new List<String>() {
                    pushConfigGroupNameOne,
                    pushConfigGroupNameTwo
                }},
                {VariableModel.NamespaceVariableName(String.Empty, CommonVariableNames.EventsPushUri), "http://localhost/blank.php"},
                {VariableModel.NamespaceVariableName(String.Empty, CommonVariableNames.EventPushIntervalSeconds), 10},
                {VariableModel.NamespaceVariableName(pushConfigGroupNameOne, CommonVariableNames.EventsPushUri), "http://localhost/one.php"},
                {VariableModel.NamespaceVariableName(pushConfigGroupNameOne, CommonVariableNames.EventPushIntervalSeconds), 20},
                {VariableModel.NamespaceVariableName(pushConfigGroupNameTwo, CommonVariableNames.EventsPushUri), "http://localhost/two.php"},
                {VariableModel.NamespaceVariableName(pushConfigGroupNameTwo, CommonVariableNames.EventPushIntervalSeconds), 30}
            };

            var rand = new Random(seed);

            foreach (String groupVariableKey in groupVariables.Keys.OrderBy(key => rand.Next()).ToList()) {
                variables.Set(new Command() {
                    Origin = CommandOrigin.Local,
                    CommandType = CommandType.VariablesSet
                }, groupVariableKey, groupVariables[groupVariableKey]);
            }

            Assert.IsTrue(pushEvents.EndPoints.ContainsKey(String.Empty));
            Assert.AreEqual("http://localhost/blank.php", pushEvents.EndPoints[String.Empty].Uri.ToString());
            Assert.AreEqual(10, pushEvents.EndPoints[String.Empty].Interval);

            Assert.IsTrue(pushEvents.EndPoints.ContainsKey(pushConfigGroupNameOne));
            Assert.AreEqual("http://localhost/one.php", pushEvents.EndPoints[pushConfigGroupNameOne].Uri.ToString());
            Assert.AreEqual(20, pushEvents.EndPoints[pushConfigGroupNameOne].Interval);

            Assert.IsTrue(pushEvents.EndPoints.ContainsKey(pushConfigGroupNameTwo));
            Assert.AreEqual("http://localhost/two.php", pushEvents.EndPoints[pushConfigGroupNameTwo].Uri.ToString());
            Assert.AreEqual(30, pushEvents.EndPoints[pushConfigGroupNameTwo].Interval);
        }
Beispiel #41
0
        public void TestComplexValue() {
            var variables = new VariableController();

            variables.SetA(new Command() {
                Origin = CommandOrigin.Local
            }, "key", new VariableComplexValue() {
                PropertyOne = 1,
                PropertyTwo = "two"
            });

            var value = variables.ArchiveVariables.Values.First(v => v.Name == "key").ToType<VariableComplexValue>();

            Assert.AreEqual(1, value.PropertyOne);
            Assert.AreEqual("two", value.PropertyTwo);
        }
Beispiel #42
0
        public void TestNoPassword() {
            var variables = new VariableController();
            var certificate = new CertificateController() {
                Shared = {
                    Variables = variables
                }
            };

            variables.Variable(CommonVariableNames.CommandServerCertificatePath).Value = Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "NoPassword.pfx");

            certificate.Execute();

            Assert.IsNotNull(certificate.Certificate);
            Assert.IsNotNull(certificate.Certificate.PrivateKey);
        }
Beispiel #43
0
        public static void InitializePaths(VariableController variableController, FeatureContext featureContext)
        {
            // User
            var userDir = new UserDirectory().Get();
            var dir     = $"{userDir}{Path.DirectorySeparatorChar}{featureContext.FeatureInfo.Title}";

            Directory.CreateDirectory(dir);
            variableController.SetPath(Infrastructures.Constants.USER_DIR, dir);

            // Bin

            var binDir = new BinDirectory().Get();

            variableController.SetPath(Infrastructures.Constants.BIN_DIR, binDir);
        }
        //cargar variables

        protected void cargarVariables()
        {
            MuestraController mc = new MuestraController();
            string            h  = mc.getNumeroMuestras(Session["pk_pro"].ToString());

            Session["numeroMuestras"] = h;
            hNumeroMuestra.InnerText  = "Muestra numero: " + (Int32.Parse(h) + 1);

            VariableController vc = new VariableController();

            dtVariables    = vc.consultarVariablesProyecto(Session["pk_pro"].ToString());
            rep.DataSource = dtVariables;
            rep.DataBind();
            Session["dtVariables"] = dtVariables;
        }
Beispiel #45
0
        public void LoadData()
        {
            int id = Request.QueryString["id"].ToInt(0);

            if (id > 0)
            {
                var d = VariableController.GetByID(id);
                if (d != null)
                {
                    ViewState["ID"]      = id;
                    txtCustomerName.Text = d.VariableName;
                    chkIsHidden.Checked  = Convert.ToBoolean(d.IsHidden);
                }
            }
        }
        public void LoadDDLVariable()
        {
            var listVariable = VariableController.GetAllIsHidden(false);

            if (listVariable.Count > 0)
            {
                ddlVariable.Items.Clear();
                ddlVariable.Items.Insert(0, new ListItem("-- Chọn --", "0"));
                foreach (var p in listVariable)
                {
                    ListItem listitem = new ListItem(p.VariableName, p.ID.ToString());
                    ddlVariable.Items.Add(listitem);
                }
                ddlVariable.DataBind();
            }
        }
Beispiel #47
0
        public RequestDto(IEnumerable <Header> headers, VariableController variableController)
        {
            this.headers            = headers;
            this.variableController = variableController;

            Header = SetData(HeaderType.HEADER);
            Query  = SetData(HeaderType.QUERY);

            var body = GetBody();

            if (body != null)
            {
                var obj = body.GetObject();
                Content = obj.GetHttpContent(body);
            }
        }
        public static VariableController Reload(this VariableController variableController, SpecFlowContext context)
        {
            var controller = variableController;

            foreach (var(key, value) in context)
            {
                if (!controller.Variables.ContainsKey(key))
                {
                    if (value is Variable variable)
                    {
                        controller.Variables.TryAdd(key, variable);
                    }
                }
            }
            return(controller);
        }
        public void LoadData()
        {
            string s = "";

            if (Request.QueryString["s"] != null)
            {
                s = Request.QueryString["s"];
            }

            var variable = VariableController.GetAll(s);

            if (variable.Count > 0)
            {
                pagingall(variable);
            }
        }
        public void TestParseMultiple() {
            var variables = new VariableController();
            variables.ParseArguments(@"-key1 ""value1"" -key2 2".Wordify());

            VariableModel variableOne = variables.Get(new Command() {
                Origin = CommandOrigin.Local
            }, "key1").Now.Variables.First();
            VariableModel variableTwo = variables.Get(new Command() {
                Origin = CommandOrigin.Local
            }, "key2").Now.Variables.First();

            Assert.AreEqual("value1", variableOne.ToType(String.Empty));
            Assert.IsTrue(variableOne.Readonly);

            Assert.AreEqual(2, variableTwo.ToType(0));
            Assert.IsTrue(variableTwo.Readonly);
        }
Beispiel #51
0
        private VariableObserver(IHubConnectionContext<dynamic> clients)
        {
            this.Clients = clients;

            try
            {
                IControl control = IControl.create();
                control.connect(IP_UTEST, 9090);
                Console.WriteLine("Connexion OK !!!");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Connexion NON OK !!!");
            }

            vc = Vs.getVariableController();

            _listDataObs = new List<DataObserver>{
                new DataObserver { DataId=2, PathName = "CODES/CT1_M1_PNT/LiveBit", ValueObs="" }
            };

            _timer = new Timer(UpdateDataObservers, null, _updateInterval, _updateInterval);

            ///=======================================================================================================
            ///Il faut charger les valeurs au moins une fois sinon la librairie n'arrive pas a récupérer le type
            ///Et donc il n'arrive pas à mettre les valeurs à jours   :/
            ///=======================================================================================================
                foreach (DataObserver rowObserver in _listDataObs)
                {

                    DataObserver dObs = readValue3(rowObserver);

                    InjectionVariableStatus status = new InjectionVariableStatus();
                    vc.getInjectionStatus(rowObserver.PathName, status);

                    if (status.state == InjectionStates.InjectionStates_IsSet)
                    {
                        rowObserver.IsForced = true;
                    }
                    else
                    {
                        rowObserver.IsForced = false;
                    }
                }
            ///=======================================================================================================
        }
Beispiel #52
0
        public void TestEmptyKeyValue() {
            var variables = new VariableController();

            // Set the value of a empty key
            ICommandResult result = variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    String.Empty,
                    "value"
                })
            });

            // Validate that the command failed (can't have an empty key)
            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.InvalidParameter, result.CommandResultType);
            Assert.AreEqual(0, variables.VolatileVariables.Count);
        }
Beispiel #53
0
        public void TestCaseInsensitive() {
            var variables = new VariableController();

            ICommandResult result = variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "key",
                    "TestVariablesSetValueCaseInsensitive"
                })
            });

            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("TestVariablesSetValueCaseInsensitive", variables.Get("Key", String.Empty));
            Assert.AreEqual("TestVariablesSetValueCaseInsensitive", variables.Get("KEY", String.Empty));
            Assert.AreEqual("TestVariablesSetValueCaseInsensitive", variables.Get("keY", String.Empty));
            Assert.AreEqual("TestVariablesSetValueCaseInsensitive", variables.Get("Key", String.Empty));
        }
Beispiel #54
0
        public void TestValue() {
            var variables = new VariableController();

            variables.VolatileVariables.TryAdd("key", new VariableModel() {
                Name = "key",
                Value = "value"
            });

            ICommandResult result = variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesGet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    "key"
                })
            });

            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("value", result.Now.Variables.First().ToType(String.Empty));
        }
Beispiel #55
0
        /// <summary>
        /// Opens a database driver to a SQLite in-memory database
        /// </summary>
        /// <returns>this</returns>
        public static DatabaseController OpenDatabaseDriver() {
            VariableController variables = new VariableController();

            DatabaseController database = new DatabaseController() {
                Shared = {
                    Variables = variables
                }
            }.Execute() as DatabaseController;
            
            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, CommonVariableNames.DatabaseDriverName, "SQLite");

            variables.Set(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet
            }, CommonVariableNames.DatabaseMemory, true);
            
            return database;
        }
Beispiel #56
0
 // Use this for initialization
 void Start()
 {
     variables = GameObject.Find("Variables").GetComponent<VariableController>();
 }
Beispiel #57
0
        public void TestOverrideExisting() {
            var variables = new VariableController();

            // Set an archive variable
            ICommandResult result = variables.Tunnel(CommandBuilder.VariablesSetF("key", "value").SetOrigin(CommandOrigin.Local));

            // Validate that initially setting the VariableModel is successful.
            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("value", variables.Get("key", String.Empty));
            Assert.AreEqual("value", variables.FlashVariables.Values.First(v => v.Name == "key").ToType<String>());

            result = variables.Tunnel(CommandBuilder.VariablesSetF("key", "changed value").SetOrigin(CommandOrigin.Local));

            // Validate that we changed changed an existing VariableModel value.
            Assert.IsTrue(result.Success);
            Assert.AreEqual(CommandResultType.Success, result.CommandResultType);
            Assert.AreEqual("changed value", variables.Get("key", String.Empty));
            Assert.AreEqual("changed value", variables.FlashVariables.Values.First(v => v.Name == "key").ToType<String>());
        }
Beispiel #58
0
        /// <summary>
        /// Read value 3 retourne un DataObserver
        /// </summary>
        /// <param name="completeVariable"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        private DataObserver readValue3(DataObserver oldDataObs)
        {
            DataObserver dObs = oldDataObs;
            string completeVariable = oldDataObs.PathName;
            int importOk = vc.importVariable(completeVariable);
            int typeVS = -1;
            long oldTimeStamp = oldDataObs.Timestamp;
            long timeStamp = 0;
            string value = "-10";
            vc = Vs.getVariableController();
            vc.getType(completeVariable, out typeVS);
            Console.WriteLine("readValue : " + completeVariable + " TYPE " + typeVS + " VC " + importOk);

            if (importOk != 0 && !oldDataObs.IsChanging)
            {
                switch (typeVS)
                {
                    ///=================================================================================================
                    /// Si le type est égal à 1 alors c'est un entier
                    ///=================================================================================================
                    case 1:
                        dObs.Type = VS_Type.INTEGER;
                        IntegerReader intr = vc.createIntegerReader(completeVariable);
                        int valVarInt;

                        if (intr != null)
                        {
                            intr.setBlocking(1 * 200);
                            VariableState t = intr.waitForConnection();

                            if (t == VariableState.Ok)
                            {
                                intr.get(out valVarInt, out timeStamp);
                                value = valVarInt.ToString();
                            }
                        }

                        break;
                    ///=================================================================================================
                    ///=================================================================================================
                    /// Si le type est égal à 2 alors c'est un double
                    ///=================================================================================================
                    case 2:
                        dObs.Type = VS_Type.DOUBLE;
                        DoubleReader dblr = vc.createDoubleReader(completeVariable);
                        double valVarDbl;

                        if (dblr != null)
                        {
                            dblr.setBlocking(1 * 200);
                            VariableState t = dblr.waitForConnection();

                            if (t == VariableState.Ok)
                            {
                                dblr.get(out valVarDbl, out timeStamp);
                                value = valVarDbl.ToString();
                            }
                        }
                        break;
                    ///=================================================================================================
                    default:
                        dObs.Type = VS_Type.INVALID;
                        value = "Undefined";
                        break;
                }

                if (!oldDataObs.ValueObs.Equals(value))
                {
                    dObs.ValueObs = value;
                    dObs.ValueHasChanged = true;
                }
                else
                {
                    dObs.ValueHasChanged = false;
                }

                dObs.Timestamp = timeStamp;
            }

            return dObs;
        }
        public void TestPotatoAddConnectionExceedMaximumConnectionLimit() {
            var variables = new VariableController();
            var instance = (PotatoController)new PotatoController() {
                Shared = {
                    Variables = variables
                }
            }.Execute();

            // Lower the maximum connections to nothing
            variables.Set(new Command() {
                Origin = CommandOrigin.Local
            }, CommonVariableNames.MaximumProtocolConnections, 0);

            ICommandResult result = instance.Tunnel(CommandBuilder.PotatoAddConnection("Myrcon", "MockProtocol", "1.1.1.1", 27516, "password", "").SetOrigin(CommandOrigin.Local));

            Assert.IsFalse(result.Success);
            Assert.AreEqual(CommandResultType.LimitExceeded, result.CommandResultType);
            Assert.AreEqual(0, instance.Connections.Count);

            instance.Dispose();
        }
Beispiel #60
0
        public void TestRemovesArchiveVariable() {
            var variables = new VariableController();

            // Set a archive variable.
            variables.Tunnel(CommandBuilder.VariablesSetA("key", "value").SetOrigin(CommandOrigin.Local));

            // Set a flash value
            variables.Tunnel(CommandBuilder.VariablesSetF("key", "value").SetOrigin(CommandOrigin.Local));

            // Validate archive value exists and flash value does not.
            Assert.IsEmpty(variables.ArchiveVariables);
            Assert.IsNotEmpty(variables.FlashVariables);
        }