src/instance.js
function fakeModelInstance (values, options) {
	this.options = options || {};
	
	/**
	 * As with Sequelize, we include a `dataValues` property which contains the values for the
	 * instance. As with Sequelize, you should use other methods to edit the values for any
	 * code that will also interact with Sequelize.
	 * 
	 * For test code, when possible, we also recommend you use other means to validate. But
	 * this object is also available if needed.
	 * 
	 * @name dataValues
	 * @alias _values
	 * @member {Object}
	 **/
	this.dataValues = this._values = _.clone(values || {});
	
	this.hasPrimaryKeys = this.Model.options.hasPrimaryKeys;
	if(this.hasPrimaryKeys) {
		this.dataValues.id = this.dataValues.id || (++id);
	}
	
	if(this.Model.options.timestamps) {
		this.dataValues.createdAt = this.dataValues.createdAt || new Date();
		this.dataValues.updatedAt = this.dataValues.updatedAt || new Date();
	}
	
	// Double underscore for test specific internal variables
	this.__validationErrors = [];
	
	// Add the items from the dataValues to be accessible via a simple `instance.value` call
	var self = this;
	_.each(this.dataValues, function (val, key) {
		
		Object.defineProperty(self, key, {
			get: function () {
				return fakeModelInstance.prototype.get.call(self, key);
			},
			set: function (value) {
				fakeModelInstance.prototype.set.call(self, key, value);
			},
		});
	});
}
function fakeModelInstance (values, options) {
	this.options = options || {};
	
	/**
	 * As with Sequelize, we include a `dataValues` property which contains the values for the
	 * instance. As with Sequelize, you should use other methods to edit the values for any
	 * code that will also interact with Sequelize.
	 * 
	 * For test code, when possible, we also recommend you use other means to validate. But
	 * this object is also available if needed.
	 * 
	 * @name dataValues
	 * @alias _values
	 * @member {Object}
	 **/
	this.dataValues = this._values = _.clone(values || {});
	
	this.hasPrimaryKeys = this.Model.options.hasPrimaryKeys;
	if(this.hasPrimaryKeys) {
		this.dataValues.id = this.dataValues.id || (++id);
	}
	
	if(this.Model.options.timestamps) {
		this.dataValues.createdAt = this.dataValues.createdAt || new Date();
		this.dataValues.updatedAt = this.dataValues.updatedAt || new Date();
	}
	
	// Double underscore for test specific internal variables
	this.__validationErrors = [];
	
	// Add the items from the dataValues to be accessible via a simple `instance.value` call
	var self = this;
	_.each(this.dataValues, function (val, key) {
		
		Object.defineProperty(self, key, {
			get: function () {
				return fakeModelInstance.prototype.get.call(self, key);
			},
			set: function (value) {
				fakeModelInstance.prototype.set.call(self, key, value);
			},
		});
	});
}
function fakeModelInstance ( values , options ) { this . options = options || { } ; /**
	 * As with Sequelize, we include a `dataValues` property which contains the values for the
	 * instance. As with Sequelize, you should use other methods to edit the values for any
	 * code that will also interact with Sequelize.
	 * 
	 * For test code, when possible, we also recommend you use other means to validate. But
	 * this object is also available if needed.
	 * 
	 * @name dataValues
	 * @alias _values
	 * @member {Object}
	 **/ this . dataValues = this . _values = _ . clone ( values || { } ) ; this . hasPrimaryKeys = this . Model . options . hasPrimaryKeys ; if ( this . hasPrimaryKeys ) { this . dataValues . id = this . dataValues . id || ( ++ id ) ; } if ( this . Model . options . timestamps ) { this . dataValues . createdAt = this . dataValues . createdAt || new Date ( ) ; this . dataValues . updatedAt = this . dataValues . updatedAt || new Date ( ) ; } // Double underscore for test specific internal variables this . __validationErrors = [ ] ; // Add the items from the dataValues to be accessible via a simple `instance.value` call var self = this ; _ . each ( this . dataValues , function ( val , key ) { Object . defineProperty ( self , key , { get : function ( ) { return fakeModelInstance . prototype . get . call ( self , key ) ; } , set : function ( value ) { fakeModelInstance . prototype . set . call ( self , key , value ) ; } , } ) ; } ) ; }
Instance Mock Object. Creation of this object should almost always be handled through the
`Model` class methods. In cases when you need to create an `Instance` directly, providing
the `defaults` parameter should be enough, as the `obj` overrides parameter is optional.

@class Instance
@constructor
@param {Object} defaults The default values. This will come from the Model when created via that class
@param {Object} [obj] Any overridden values that should be specific to this instance
Instance Mock Object . Creation of this object should almost always be handled through the Model class methods . In cases when you need to create an Instance directly providing the defaults parameter should be enough as the obj overrides parameter is optional .