Пример #1
0
        protected Runnable CreateProcedureFrom(string name, Dictionary <string, object> values)
        {
            var procedureName = string.Format("RANDOM.{0}", name);
            var parameters    = new Adapter().CreateParametersFrom(values);

            return(Runnable.StoreProcedure(procedureName, parameters));
        }
Пример #2
0
        protected Runnable CreateProcedureFrom(string name, object model, params string[] parametersNames)
        {
            var procedureName = string.Format("RANDOM.{0}", name);
            var parameters    = new Adapter().CreateParametersFrom(model, parametersNames);

            return(Runnable.StoreProcedure(procedureName, parameters));
        }
Пример #3
0
        public void Update_parameters_from_should_only_replace_the_specified_parameters()
        {
            var firstParameters = this.CreateParametersFrom(new Dictionary <string, object> {
                { "Price", 15 }, { "Id", "Potatoes3356" }
            });
            var firstProcedure = Runnable.StoreProcedure("TheFirstOne", firstParameters);

            var secondParameters = this.CreateParametersFrom(new Dictionary <string, object> {
                { "Price", 30 }, { "Id", "1324567" }
            });
            var secondProcedure = Runnable.StoreProcedure("TheSecondOne", secondParameters, new[] { "Price" });

            secondProcedure.UpdateParametersFrom(firstProcedure);

            Assert.Equal(15, secondProcedure.GetParameterValue("Price"));
            Assert.Equal("1324567", secondProcedure.GetParameterValue("Id"));
        }
Пример #4
0
        public void Update_parameters_from_should_ignore_the_different_parameters()
        {
            var firstParameters = this.CreateParametersFrom(new Dictionary <string, object> {
                { "Price", 15 }, { "Desc", "Potatoes3356" }
            });
            var firstProcedure = Runnable.StoreProcedure("TheFirstOne", firstParameters);

            var secondParameters = this.CreateParametersFrom(new Dictionary <string, object> {
                { "Quantity", 30 }, { "Id", "1324567" }
            });
            var secondProcedure = Runnable.StoreProcedure("TheSecondOne", secondParameters);

            secondProcedure.UpdateParametersFrom(firstProcedure);

            Assert.Equal(30, secondProcedure.GetParameterValue("Quantity"));
            Assert.Equal("1324567", secondProcedure.GetParameterValue("Id"));
        }