function withBalancedBindProperty(assert, fnCodeUnderTest) {
		var fnBindProperty = ManagedObject.prototype.bindProperty,
			oSandbox = sinon.sandbox.create();

		try {
			oSandbox.stub(ManagedObject.prototype, "bindProperty",
				function (sName, oBindingInfo) {
					assert.strictEqual(sName, "any");
					assert.strictEqual(oBindingInfo.mode, BindingMode.OneTime);
					(oBindingInfo.parts || []).forEach(function (oInfoPart) {
						assert.strictEqual(oInfoPart.mode, BindingMode.OneTime);
					});
					fnBindProperty.apply(this, arguments);
				});
			oSandbox.spy(ManagedObject.prototype, "unbindProperty");

			fnCodeUnderTest();

			assert.strictEqual(ManagedObject.prototype.unbindProperty.callCount,
				ManagedObject.prototype.bindProperty.callCount,
				"balance of bind and unbind");
			if (ManagedObject.prototype.unbindProperty.callCount) {
				sinon.assert.alwaysCalledWith(ManagedObject.prototype.unbindProperty,
					"any", true);
			}
		} finally {
			oSandbox.restore();
		}
	}
/**
	 * Call the given code under test, making sure that properties are bound and unbound in
	 * balance.
	 * @param {object} assert the assertions
	 * @param {function} fnCodeUnderTest
	 *   code under test
	 */
Call the given code under test, making sure that properties are bound and unbound in
balance.
@param {object} assert the assertions
@param {function} fnCodeUnderTest
code under test
Call the given code under test making sure that properties are bound and unbound in balance . @param { object } assert the assertions @param { function } fnCodeUnderTest code under test
function withBalancedBindProperty(assert, fnCodeUnderTest) {
		var fnBindProperty = ManagedObject.prototype.bindProperty,
			oSandbox = sinon.sandbox.create();
		try {
			oSandbox.stub(ManagedObject.prototype, "bindProperty",
				function (sName, oBindingInfo) {
					assert.strictEqual(sName, "any");
					assert.strictEqual(oBindingInfo.mode, BindingMode.OneTime);
					(oBindingInfo.parts || []).forEach(function (oInfoPart) {
						assert.strictEqual(oInfoPart.mode, BindingMode.OneTime);
					});
					fnBindProperty.apply(this, arguments);
				});
			oSandbox.spy(ManagedObject.prototype, "unbindProperty");
			fnCodeUnderTest();
			assert.strictEqual(ManagedObject.prototype.unbindProperty.callCount,
				ManagedObject.prototype.bindProperty.callCount,
				"balance of bind and unbind");
			if (ManagedObject.prototype.unbindProperty.callCount) {
				sinon.assert.alwaysCalledWith(ManagedObject.prototype.unbindProperty,
					"any", true);
			}
		} finally {
			oSandbox.restore();
		}
	}
function withBalancedBindProperty ( assert , fnCodeUnderTest ) { var fnBindProperty = ManagedObject . prototype . bindProperty , oSandbox = sinon . sandbox . create ( ) ; try { oSandbox . stub ( ManagedObject . prototype , "bindProperty" , function ( sName , oBindingInfo ) { assert . strictEqual ( sName , "any" ) ; assert . strictEqual ( oBindingInfo . mode , BindingMode . OneTime ) ; ( oBindingInfo . parts || [ ] ) . forEach ( function ( oInfoPart ) { assert . strictEqual ( oInfoPart . mode , BindingMode . OneTime ) ; } ) ; fnBindProperty . apply ( this , arguments ) ; } ) ; oSandbox . spy ( ManagedObject . prototype , "unbindProperty" ) ; fnCodeUnderTest ( ) ; assert . strictEqual ( ManagedObject . prototype . unbindProperty . callCount , ManagedObject . prototype . bindProperty . callCount , "balance of bind and unbind" ) ; if ( ManagedObject . prototype . unbindProperty . callCount ) { sinon . assert . alwaysCalledWith ( ManagedObject . prototype . unbindProperty , "any" , true ) ; } } finally { oSandbox . restore ( ) ; } }
Call the given code under test, making sure that properties are bound and unbound in
 balance.
Call the given code under test making sure that properties are bound and unbound in balance .