/// <summary>
        /// Get insert plan for a given type
        /// </summary>
        /// <param name="type">Type</param>
        /// <returns>plan</returns>
        public virtual IOperationPlan GetInsertPlan(Type type)
        {
            var map    = this._mappingManager.GetMapping(type);
            var insert = new InsertPlan(map, this._typeRegister);

            return(insert);
        }
        /// <summary>
        /// Get insert plan for a given type
        /// </summary>
        /// <param name="type">Type</param>
        /// <returns>plan</returns>
        public virtual IOperationPlan GetInsertPlan(Type type)
        {
            var map = this._mappingManager.GetMapping(type);
            var insert = new InsertPlan(map, this._typeRegister);

            return insert;
        }
Exemple #3
0
        public void GetText_Returns_InsertText()
        {
            var person = new Person();
            var mapping = new PersonMap();
            mapping.ExecuteMapping();

            var mapInt = new TypeMap(DbType.Int32,typeof(int),new GenericConverter());
            var mapString = new TypeMap(DbType.String,typeof(string),new GenericConverter());

            var mock = new Moq.Mock<ITypeRegister>();
            mock.Setup(x => x.Get(typeof (int))).Returns(mapInt);
            mock.Setup(x => x.Get(typeof(string))).Returns(mapString);

            var dbparam = new Moq.Mock<IDbDataParameter>();
            Func<IDbDataParameter> func = () => dbparam.Object;

            var register = mock.Object;

            var insert = new InsertPlan(mapping, register);
            var text = insert.CreatePlanParameter(func, person);

            text.SqlText.ToUpper().Should().Be("INSERT INTO PERSON (NAME, AGE) VALUES (@NAME, @AGE)");
        }