Пример #1
0
        /// <summary>
        /// Get update plan for a given type
        /// </summary>
        /// <param name="type">Type</param>
        /// <returns>plan</returns>
        public IOperationPlan GetUpdatePlan(Type type)
        {
            var map    = this._mappingManager.GetMapping(type);
            var update = new UpdatePlan(map, this._typeRegister);

            return(update);
        }
Пример #2
0
        public void GetText_Returns_UpdateText()
        {
            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 UpdatePlan(mapping, register);
            var text = insert.CreatePlanParameter(func, person);

            text.SqlText.ToUpper().Should().Be("UPDATE PERSON SET NAME = @NAME, AGE = @AGE WHERE ID = @ID");
            text.Parameters.Count.Should().Be(3);
        }
Пример #3
0
        /// <summary>
        /// Get update plan for a given type
        /// </summary>
        /// <param name="type">Type</param>
        /// <returns>plan</returns>
        public IOperationPlan GetUpdatePlan(Type type)
        {
            var map = this._mappingManager.GetMapping(type);
            var update = new UpdatePlan(map, this._typeRegister);

            return update;
        }