Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "typemoq", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "A simple mocking library for TypeScript", | ||
@@ -5,0 +5,0 @@ "author": "Florin Nitoi <florin.nitoi@gmail.com>", |
153
README.md
@@ -6,8 +6,3 @@ TypeMoq [![build badge](https://travis-ci.org/florinn/typemoq.svg?branch=master)](https://travis-ci.org/florinn/typemoq) | ||
---------- | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/florinn.svg)](https://saucelabs.com/u/florinn) | ||
---------- | ||
Features | ||
@@ -23,3 +18,9 @@ ------------- | ||
---------- | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/florinn.svg)](https://saucelabs.com/u/florinn) | ||
---------- | ||
Installing | ||
@@ -62,11 +63,17 @@ ------------- | ||
At this point you should have access in your script to a global variable named `typemoq` | ||
At this point you should have access in your script to a global variable named `TypeMoq`. | ||
###### Node.js runtime | ||
`typemoq.node.d.ts` declares an external module to use in node.js (commonjs) projects: | ||
* **TypeScript 1.6 and later** | ||
```typescript | ||
/// <reference path="./node_modules/typemoq/typemoq.node.d.ts" /> | ||
import * as TypeMoq from "typemoq"; | ||
``` | ||
* **TypeScript pre 1.6** | ||
```typescript | ||
/// <reference path="./node_modules/typemoq/typemoq.d.ts" /> | ||
typemoq = require("typemoq"); | ||
@@ -100,16 +107,16 @@ ``` | ||
// Using class as constructor parameter | ||
var mock: TypeMoq.Mock<Bar> = typemoq.Mock.ofType(Bar); | ||
var mock: TypeMoq.Mock<Bar> = TypeMoq.Mock.ofType(Bar); | ||
// Using class as constructor parameter and casting result to interface | ||
var mock: TypeMoq.Mock<IBar> = typemoq.Mock.ofType(Bar); | ||
var mock: TypeMoq.Mock<IBar> = TypeMoq.Mock.ofType(Bar); | ||
// Using interface as type variable and class as constructor parameter | ||
var mock: TypeMoq.Mock<IBar> = typemoq.Mock.ofType<IBar>(Bar); | ||
var mock: TypeMoq.Mock<IBar> = TypeMoq.Mock.ofType<IBar>(Bar); | ||
// Using class as constructor parameter and args | ||
var bar = new Bar(); | ||
var mock: TypeMoq.Mock<Foo> = typemoq.Mock.ofType(Foo, typemoq.MockBehavior.Loose, bar); | ||
var mock: TypeMoq.Mock<Foo> = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, bar); | ||
// Using a generic class as constructor parameter and args | ||
var mock: TypeMoq.Mock<GenericFoo<Bar>> = typemoq.Mock.ofType(GenericFoo, typemoq.MockBehavior.Loose, Bar); | ||
var mock: TypeMoq.Mock<GenericFoo<Bar>> = TypeMoq.Mock.ofType(GenericFoo, TypeMoq.MockBehavior.Loose, Bar); | ||
``` | ||
@@ -123,7 +130,7 @@ | ||
var bar = new Bar(); | ||
var mock: TypeMoq.Mock<Bar> = typemoq.Mock.ofInstance(bar); | ||
var mock: TypeMoq.Mock<Bar> = TypeMoq.Mock.ofInstance(bar); | ||
// Or from function objects | ||
var mock1: TypeMoq.Mock<() => string> = typemoq.Mock.ofInstance(someFunc); | ||
var mock2: TypeMoq.Mock<(a: any, b: any, c: any)=>string> = typemoq.Mock.ofInstance(someFuncWithArgs); | ||
var mock1: TypeMoq.Mock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
var mock2: TypeMoq.Mock<(a: any, b: any, c: any)=>string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
``` | ||
@@ -143,8 +150,8 @@ | ||
// Match a no args function | ||
var mock: TypeMoq.Mock<() => string> = typemoq.Mock.ofInstance(someFunc); | ||
var mock: TypeMoq.Mock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
mock.setup(x => x()).returns(() => "At vero eos et accusamus"); | ||
// Match a function with args | ||
var mock: TypeMoq.Mock<(a: any, b: any, c: any) => string> = typemoq.Mock.ofInstance(someFuncWithArgs); | ||
mock.setup(x => x(typemoq.It.isAny(), typemoq.It.isAny(), typemoq.It.isAny())).returns(() => "At vero eos et accusamus"); | ||
var mock: TypeMoq.Mock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
mock.setup(x => x(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => "At vero eos et accusamus"); | ||
``` | ||
@@ -155,3 +162,3 @@ | ||
```typescript | ||
var mock = typemoq.Mock.ofType(Doer); | ||
var mock = TypeMoq.Mock.ofType(Doer); | ||
@@ -162,3 +169,3 @@ // Match a no args method | ||
// Match a method with explicit number value params | ||
mock.setup(x => x.doNumber(typemoq.It.isValue(321))); | ||
mock.setup(x => x.doNumber(TypeMoq.It.isValue(321))); | ||
@@ -169,3 +176,3 @@ // Match a method with implicit number value params | ||
// Match a method with explicit string value params | ||
mock.setup(x => x.doString(typemoq.It.isValue("abc"))); | ||
mock.setup(x => x.doString(TypeMoq.It.isValue("abc"))); | ||
@@ -177,9 +184,9 @@ // Match a method with implicit string value params | ||
var bar = new Bar(); | ||
mock.setup(x => x.doObject(typemoq.It.isAnyObject(Bar))); | ||
mock.setup(x => x.doObject(TypeMoq.It.isAnyObject(Bar))); | ||
// Match a method with any string params | ||
mock.setup(x => x.doString(typemoq.It.isAnyString())); | ||
mock.setup(x => x.doString(TypeMoq.It.isAnyString())); | ||
// Match a method with any number params | ||
mock.setup(x => x.doNumber(typemoq.It.isAnyNumber())); | ||
mock.setup(x => x.doNumber(TypeMoq.It.isAnyNumber())); | ||
@@ -189,3 +196,3 @@ // Match a method with any interface/class params | ||
var bar2 = new Bar(); | ||
mock.setup(x => x.doBar(typemoq.It.isAnyObject(Bar))); | ||
mock.setup(x => x.doBar(TypeMoq.It.isAnyObject(Bar))); | ||
``` | ||
@@ -197,3 +204,3 @@ | ||
// match a property getter | ||
var mock = typemoq.Mock.ofType(FooWithPublicGetterAndSetter); | ||
var mock = TypeMoq.Mock.ofType(FooWithPublicGetterAndSetter); | ||
mock.setup(x => x.foo); | ||
@@ -223,8 +230,8 @@ ``` | ||
```typescript | ||
var mock = typemoq.Mock.ofType(Doer); | ||
var mock = TypeMoq.Mock.ofType(Doer); | ||
var called1, called2 = false; | ||
var numberArg: number; | ||
mock.setup(x => x.doString(typemoq.It.isAnyString())).callback(() => called1 = true).returns(s => s.toUpperCase()); | ||
mock.setup(x => x.doNumber(typemoq.It.isAnyNumber())).callback(n => { numberArg = n; called2 = true; }).returns(n => n + 1); | ||
mock.setup(x => x.doString(TypeMoq.It.isAnyString())).callback(() => called1 = true).returns(s => s.toUpperCase()); | ||
mock.setup(x => x.doNumber(TypeMoq.It.isAnyNumber())).callback(n => { numberArg = n; called2 = true; }).returns(n => n + 1); | ||
``` | ||
@@ -239,3 +246,3 @@ | ||
```typescript | ||
var mock = typemoq.Mock.ofInstance(() => -1); | ||
var mock = TypeMoq.Mock.ofInstance(() => -1); | ||
@@ -253,3 +260,3 @@ // record | ||
```typescript | ||
var mock = typemoq.Mock.ofInstance(() => -1); | ||
var mock = TypeMoq.Mock.ofInstance(() => -1); | ||
@@ -282,3 +289,3 @@ // record | ||
```typescript | ||
var mock = typemoq.Mock.ofType(Doer, typemoq.MockBehavior.Strict); | ||
var mock = TypeMoq.Mock.ofType(Doer, TypeMoq.MockBehavior.Strict); | ||
``` | ||
@@ -304,30 +311,30 @@ | ||
// Verify that a no args function was called at least once | ||
var mock: TypeMoq.Mock<() => string> = typemoq.Mock.ofInstance(someFunc); | ||
var mock: TypeMoq.Mock<() => string> = TypeMoq.Mock.ofInstance(someFunc); | ||
mock.object(); | ||
mock.verify(x => x(), typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x(), TypeMoq.Times.atLeastOnce()); | ||
// Verify that a function with args was called at least once | ||
var mock: TypeMoq.Mock<(a: any, b: any, c: any) => string> = typemoq.Mock.ofInstance(someFuncWithArgs); | ||
var mock: TypeMoq.Mock<(a: any, b: any, c: any) => string> = TypeMoq.Mock.ofInstance(someFuncWithArgs); | ||
mock.object(1, 2, 3); | ||
mock.verify(x => x(typemoq.It.isAnyNumber(), typemoq.It.isAnyNumber(), typemoq.It.isAnyNumber()), typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x(TypeMoq.It.isAnyNumber(), TypeMoq.It.isAnyNumber(), TypeMoq.It.isAnyNumber()), TypeMoq.Times.atLeastOnce()); | ||
// Verify that no args method was called at least once | ||
var mock = typemoq.Mock.ofType(Doer); | ||
var mock = TypeMoq.Mock.ofType(Doer); | ||
mock.object.doVoid(); | ||
mock.verify(x => x.doVoid(), typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x.doVoid(), TypeMoq.Times.atLeastOnce()); | ||
// Verify that method with params was called at least once | ||
var mock = typemoq.Mock.ofType(Doer); | ||
var mock = TypeMoq.Mock.ofType(Doer); | ||
mock.object.doString("Lorem ipsum dolor sit amet"); | ||
mock.verify(x => x.doString(typemoq.It.isValue("Lorem ipsum dolor sit amet")), typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x.doString(TypeMoq.It.isValue("Lorem ipsum dolor sit amet")), TypeMoq.Times.atLeastOnce()); | ||
// Verify that value getter was called at least once | ||
var mock = typemoq.Mock.ofType(Bar); | ||
var mock = TypeMoq.Mock.ofType(Bar); | ||
mock.object.value; | ||
mock.verify(x => x.value, typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x.value, TypeMoq.Times.atLeastOnce()); | ||
// Verify that value setter was called at least once | ||
var mock = typemoq.Mock.ofType(Bar); | ||
var mock = TypeMoq.Mock.ofType(Bar); | ||
mock.object.value = "Lorem ipsum dolor sit amet"; | ||
mock.verify(x => x.value = typemoq.It.isValue("Lorem ipsum dolor sit amet"), typemoq.Times.atLeastOnce()); | ||
mock.verify(x => x.value = TypeMoq.It.isValue("Lorem ipsum dolor sit amet"), TypeMoq.Times.atLeastOnce()); | ||
``` | ||
@@ -341,4 +348,4 @@ | ||
```typescript | ||
var mockBar = typemoq.Mock.ofType(Bar); | ||
var mockFoo = typemoq.Mock.ofType(Foo, typemoq.MockBehavior.Loose, mockBar.object); | ||
var mockBar = TypeMoq.Mock.ofType(Bar); | ||
var mockFoo = TypeMoq.Mock.ofType(Foo, TypeMoq.MockBehavior.Loose, mockBar.object); | ||
mockFoo.callBase = true; | ||
@@ -348,3 +355,3 @@ | ||
mockBar.verify(x => x.value = typemoq.It.isValue("Lorem ipsum dolor sit amet"), typemoq.Times.atLeastOnce()); | ||
mockBar.verify(x => x.value = TypeMoq.It.isValue("Lorem ipsum dolor sit amet"), TypeMoq.Times.atLeastOnce()); | ||
``` | ||
@@ -355,6 +362,6 @@ | ||
```typescript | ||
var mock = typemoq.Mock.ofType(Doer); | ||
var mock = TypeMoq.Mock.ofType(Doer); | ||
mock.setup(x => x.doNumber(999)).verifiable(); | ||
mock.setup(x => x.doString(typemoq.It.isAny())).verifiable(); | ||
mock.setup(x => x.doString(TypeMoq.It.isAny())).verifiable(); | ||
mock.setup(x => x.doVoid()).verifiable(); | ||
@@ -385,12 +392,12 @@ | ||
// Create an instance using class as ctor parameter | ||
var mock: TypeMoq.GlobalMock<GlobalBar> = typemoq.GlobalMock.ofType(GlobalBar, null, window); | ||
var mock: TypeMoq.GlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, null, window); | ||
// Create an instance using class as ctor parameter and casting result to interface | ||
var mock: TypeMoq.GlobalMock<IGlobalBar> = typemoq.GlobalMock.ofType(GlobalBar, null, window); | ||
var mock: TypeMoq.GlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType(GlobalBar, null, window); | ||
// Create an instance using interface as type variable and class as ctor parameter | ||
var mock: TypeMoq.GlobalMock<IGlobalBar> = typemoq.GlobalMock.ofType<IGlobalBar>(GlobalBar, null, window); | ||
var mock: TypeMoq.GlobalMock<IGlobalBar> = TypeMoq.GlobalMock.ofType<IGlobalBar>(GlobalBar, null, window); | ||
// Create an instance of 'XmlHttpRequest' global type | ||
var mock = typemoq.GlobalMock.ofType(XMLHttpRequest, null, window); | ||
var mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest, null, window); | ||
``` | ||
@@ -404,18 +411,18 @@ | ||
var foo = new Foo(bar); | ||
var mock: TypeMoq.GlobalMock<Foo> = typemoq.GlobalMock.ofInstance(foo); | ||
var mock: TypeMoq.GlobalMock<Foo> = TypeMoq.GlobalMock.ofInstance(foo); | ||
// Create an instance using a generic class as ctor parameter and ctor args | ||
var foo = new GenericFoo(Bar); | ||
var mock: TypeMoq.GlobalMock<GenericFoo<Bar>> = typemoq.GlobalMock.ofInstance(foo); | ||
var mock: TypeMoq.GlobalMock<GenericFoo<Bar>> = TypeMoq.GlobalMock.ofInstance(foo); | ||
// Create an instance from an existing object | ||
var bar = new GlobalBar(); | ||
var mock: TypeMoq.GlobalMock<GlobalBar> = typemoq.GlobalMock.ofInstance(bar); | ||
var mock: TypeMoq.GlobalMock<GlobalBar> = TypeMoq.GlobalMock.ofInstance(bar); | ||
// Create an instance from a function object | ||
var mock1: TypeMoq.GlobalMock<() => string> = typemoq.GlobalMock.ofInstance(someGlobalFunc); | ||
var mock2: TypeMoq.GlobalMock<(a: any, b: any, c: any) => string> = typemoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
var mock1: TypeMoq.GlobalMock<() => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
var mock2: TypeMoq.GlobalMock<(a: any, b: any, c: any) => string> = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
// Create an instance from 'window.localStorage' global object | ||
var mock = typemoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
var mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
``` | ||
@@ -433,4 +440,4 @@ | ||
// Global no args function is auto sandboxed | ||
var mock = typemoq.GlobalMock.ofInstance(someGlobalFunc); | ||
typemoq.GlobalScope.using(mock).with(() => { | ||
var mock = TypeMoq.GlobalMock.ofInstance(someGlobalFunc); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
someGlobalFunc(); | ||
@@ -441,4 +448,4 @@ someGlobalFunc(); | ||
// Global function with args is auto sandboxed | ||
var mock = typemoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
typemoq.GlobalScope.using(mock).with(() => { | ||
var mock = TypeMoq.GlobalMock.ofInstance(someGlobalFuncWithArgs); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
someGlobalFuncWithArgs(1,2,3); | ||
@@ -450,4 +457,4 @@ someGlobalFuncWithArgs("1","2","3"); | ||
// Global object is auto sandboxed | ||
var mock = typemoq.GlobalMock.ofType(GlobalBar); | ||
typemoq.GlobalScope.using(mock).with(() => { | ||
var mock = TypeMoq.GlobalMock.ofType(GlobalBar); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
var bar1 = new GlobalBar(); | ||
@@ -459,8 +466,8 @@ bar1.value; | ||
// 'window.XmlHttpRequest' global object is auto sandboxed | ||
var mock = typemoq.GlobalMock.ofType(XMLHttpRequest); | ||
typemoq.GlobalScope.using(mock).with(() => { | ||
var mock = TypeMoq.GlobalMock.ofType(XMLHttpRequest); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
var xhr1 = new XMLHttpRequest(); | ||
xhr1.open("GET", "http://www.typescriptlang.org", true); | ||
xhr1.send(); | ||
mock.verify(x => x.send(), typemoq.Times.exactly(1)); | ||
mock.verify(x => x.send(), TypeMoq.Times.exactly(1)); | ||
}); | ||
@@ -470,8 +477,8 @@ var xhr2 = new XMLHttpRequest(); | ||
xhr2.send(); | ||
mock.verify(x => x.send(), typemoq.Times.exactly(1)); | ||
mock.verify(x => x.send(), TypeMoq.Times.exactly(1)); | ||
// 'window.localStorage' global object is auto sandboxed | ||
var mock = typemoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
mock.setup(x => x.getItem(typemoq.It.isAnyString())).returns((key: string) => "[]"); | ||
typemoq.GlobalScope.using(mock).with(() => { | ||
var mock = TypeMoq.GlobalMock.ofInstance(localStorage, "localStorage"); | ||
mock.setup(x => x.getItem(TypeMoq.It.isAnyString())).returns((key: string) => "[]"); | ||
TypeMoq.GlobalScope.using(mock).with(() => { | ||
expect(localStorage.getItem("xyz")).to.eq("[]"); | ||
@@ -478,0 +485,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
var TypeMoq;!function(e){var t=function(){function e(){}return e.IMATCH_ID_VALUE="438A51D3-6864-49D7-A655-CA1153B86965",e.IMATCH_ID_NAME="___id",e.IMATCH_MATCHES_NAME="___matches",e}();e.Cons=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(){}return e}();e.CurrentInterceptContext=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){!function(e){e[e.Class=0]="Class",e[e.Function=1]="Function",e[e.Value=2]="Value"}(e.GlobalType||(e.GlobalType={}));var t=e.GlobalType,n=function(){function n(e,t,n,o){this.mock=e,this._name=t,this._type=n,this.container=o}return n.ofInstance=function(o,r,i,c){void 0===i&&(i=window),void 0===c&&(c=e.MockBehavior.Loose);var a=e.Mock.ofInstance(o,c),u=_.isFunction(o)?t.Function:t.Value;return new n(a,r,u,i)},n.ofType=function(o,r,i,c){void 0===i&&(i=window),void 0===c&&(c=e.MockBehavior.Loose);var a=new o,u=e.Mock.ofInstance(a,c);return new n(u,r,t.Class,i)},Object.defineProperty(n.prototype,"object",{get:function(){return this.mock.object},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name||this.mock.name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this.mock.callBase},set:function(e){this.mock.callBase=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),n.prototype.setup=function(e){return this.mock.setup(e)},n.prototype.verify=function(e,t){this.mock.verify(e,t)},n.prototype.verifyAll=function(){this.mock.verifyAll()},n}();e.GlobalMock=n}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(){}return e.getOwnEnumerables=function(e){return this._getPropertyNames(e,!0,!1,this._enumerable)},e.getOwnNonenumerables=function(e){return this._getPropertyNames(e,!0,!1,this._notEnumerable)},e.getOwnEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!0,!1,this._enumerableAndNotEnumerable)},e.getPrototypeEnumerables=function(e){return this._getPropertyNames(e,!1,!0,this._enumerable)},e.getPrototypeNonenumerables=function(e){return this._getPropertyNames(e,!1,!0,this._notEnumerable)},e.getPrototypeEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!1,!0,this._enumerableAndNotEnumerable)},e.getOwnAndPrototypeEnumerables=function(e){return this._getPropertyNames(e,!0,!0,this._enumerable)},e.getOwnAndPrototypeNonenumerables=function(e){return this._getPropertyNames(e,!0,!0,this._notEnumerable)},e.getOwnAndPrototypeEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!0,!0,this._enumerableAndNotEnumerable)},e._enumerable=function(e,t){return e.propertyIsEnumerable(t)},e._notEnumerable=function(e,t){return!e.propertyIsEnumerable(t)},e._enumerableAndNotEnumerable=function(e,t){return!0},e._getPropertyNames=function(e,t,n,o){var r=[];do{if(t){var i=Object.getOwnPropertyNames(e);_.forEach(i,function(t){var n=_.find(r,function(e){return e.name===t});if(!n&&o(e,t)){var i=Object.getOwnPropertyDescriptor(e,t);r.push({name:t,desc:i})}})}if(!n)break;t=!0}while(e=Object.getPrototypeOf(e));return r},e}();e.PropertyRetriever=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(){}return e.getUUID=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)});return t},e.functionName=function(e){var t=e.toString();return t=t.substr("function ".length),t=t.substr(0,t.indexOf("("))},e.conthunktor=function(e,t){return function(){var n,o,r=function(){};return r.prototype=e.prototype,n=new r,_.isFunction(e)&&(o=e.apply(n,t)),_.isObject(o)?o:n}()},e}();e.Utils=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(e){var t=function(){function e(e,t){this.name=e,this.message=t,this.name=e}return e.prototype.toString=function(){return this.name},e}();e.Exception=t}(t=e.Error||(e.Error={}))}(TypeMoq||(TypeMoq={}));var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},TypeMoq;!function(e){var t;!function(e){!function(e){e[e.NoSetup=0]="NoSetup",e[e.MoreThanOneSetupExpression=1]="MoreThanOneSetupExpression",e[e.InvalidSetupExpression=2]="InvalidSetupExpression",e[e.InvalidMatcher=3]="InvalidMatcher",e[e.InvalidProxyArgument=4]="InvalidProxyArgument",e[e.UnknownGlobalType=5]="UnknownGlobalType",e[e.VerificationFailed=6]="VerificationFailed",e[e.MoreThanOneCall=7]="MoreThanOneCall",e[e.MoreThanNCalls=8]="MoreThanNCalls"}(e.MockExceptionReason||(e.MockExceptionReason={}));var t=(e.MockExceptionReason,function(e){function t(t,n,o,r){void 0===o&&(o="Mock Exception"),e.call(this,o,r),this.reason=t,this.ctx=n}return __extends(t,e),t}(e.Exception));e.MockException=t}(t=e.Error||(e.Error={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(t){var n=function(){function t(t){this._ctor=t,this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return this._ctor.prototype===e.constructor.prototype&&(t=!0),t},t}();t.MatchAnyObject=n;var o=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isUndefined(e)||(t=!0),t},t}();t.MatchAny=o;var r=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isString(e)&&(t=!0),t},t}();t.MatchAnyString=r;var i=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isNumber(e)&&(t=!0),t},t}();t.MatchAnyNumber=i}(t=e.Match||(e.Match={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(t){var n=function(){function t(t){this._value=t,this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isEqual(this._value,e)&&(t=!0),t},t}();t.MatchValue=n}(t=e.Match||(e.Match={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(e){var t=function(){function e(e,t){this._property=e,this._args=t}return Object.defineProperty(e.prototype,"args",{get:function(){return this._args||{length:0,callee:null}},set:function(e){this._args=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.toFunc.apply(this._property.obj,this._args)},e}();e.MethodInvocation=t;var n=function(){function e(e,t){this._property=e,this.returnValue=t}return Object.defineProperty(e.prototype,"args",{get:function(){var e=[];return Object.defineProperty(e,"callee",{configurable:!1,enumerable:!0,writable:!1,value:null}),e},set:function(e){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){},e}();e.GetterInvocation=n;var o=function(){function e(e,t){this._property=e,this._args=t}return Object.defineProperty(e.prototype,"args",{get:function(){return this._args},set:function(e){this._args=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]=this._args[0]},e}();e.SetterInvocation=o;var r=function(){function e(e,t){this.obj=e,this.name=t}return Object.defineProperty(e.prototype,"toFunc",{get:function(){var e;return e=_.isFunction(this.obj)?this.obj:this.obj[this.name]},enumerable:!0,configurable:!0}),e}();e.MethodInfo=r;var i=function(){function e(e,t){this.obj=e,this.name=t}return e}();e.PropertyInfo=i}(t=e.Proxy||(e.Proxy={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(t){var n=function(){function n(t,n){var o=this;this.check(n);var r=this,i=e.PropertyRetriever.getOwnAndPrototypeEnumerablesAndNonenumerables(n);_.each(i,function(e){if(_.isFunction(e.desc.value)){var i={configurable:e.desc.configurable,enumerable:e.desc.enumerable,writable:e.desc.writable};o.defineMethodProxy(r,t,n,e.name,i)}else{var i={configurable:e.desc.configurable,enumerable:e.desc.enumerable};o.definePropertyProxy(r,t,n,e.name,e.desc.value,i)}})}return n.of=function(t,o){n.check(t);var r;if(_.isFunction(t)){var i=e.Utils.functionName(t);r=n.methodProxyValue(o,t,i)}else r=new n(o,t);return r},n.check=function(e){n.checkNotNull(e);var t=!1;if((_.isFunction(e)||_.isObject(e)&&!n.isPrimitiveObject(e))&&(t=!0),!t)throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument should be a function or a non primitive object")},n.prototype.check=function(e){n.checkNotNull(e);var t=!1;if(_.isFunction(e)||!_.isObject(e)||n.isPrimitiveObject(e)||(t=!0),!t)throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument should be a non primitive object")},n.checkNotNull=function(e){if(_.isNull(e))throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument cannot be null")},n.isPrimitiveObject=function(e){var t=!1;return(_.isFunction(e)||_.isArray(e)||_.isDate(e)||_.isNull(e))&&(t=!0),t},n.prototype.defineMethodProxy=function(e,t,o,r,i){void 0===i&&(i={configurable:!1,enumerable:!0,writable:!1}),i.value=n.methodProxyValue(t,o,r),this.defineProperty(e,r,i)},n.methodProxyValue=function(e,n,o){function r(){var r=new t.MethodInfo(n,o),i=new t.MethodInvocation(r,arguments);return e.intercept(i),i.returnValue}return r},n.prototype.definePropertyProxy=function(e,n,o,r,i,c){function a(){var e=new t.PropertyInfo(o,r),c=new t.GetterInvocation(e,i);return n.intercept(c),c.returnValue}function u(e){var i=new t.PropertyInfo(o,r),c=new t.SetterInvocation(i,arguments);n.intercept(c)}void 0===c&&(c={configurable:!1,enumerable:!0}),c.get=a,c.set=u,this.defineProperty(e,r,c)},n.prototype.defineProperty=function(e,t,n){try{Object.defineProperty(e,t,n)}catch(o){console.log(o.message)}},n}();t.Proxy=n}(t=e.Proxy||(e.Proxy={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t;!function(e){var t=function(){function t(){}return t.prototype.createProxy=function(t,n){var o=e.Proxy.of(n,t);return o},t}();e.ProxyFactory=t}(t=e.Proxy||(e.Proxy={}))}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){!function(e){e[e.Continue=0]="Continue",e[e.Stop=1]="Stop"}(e.InterceptionAction||(e.InterceptionAction={}));var t=(e.InterceptionAction,function(){function e(e,t){this.behavior=e,this.mock=t,this._actualInvocations=[],this._orderedCalls=[]}return e.prototype.addInvocation=function(e){this._actualInvocations.push(e)},e.prototype.actualInvocations=function(){return this._actualInvocations},e.prototype.clearInvocations=function(){this._actualInvocations=[]},e.prototype.addOrderedCall=function(e){this._orderedCalls.push(e)},e.prototype.removeOrderedCall=function(e){_.filter(this._orderedCalls,function(t){return t.id!==e.id})},e.prototype.orderedCalls=function(){return this._orderedCalls},e}());e.InterceptorContext=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function t(t,n){this._interceptorContext=new e.InterceptorContext(t,n)}return Object.defineProperty(t.prototype,"interceptorContext",{get:function(){return this._interceptorContext},enumerable:!0,configurable:!0}),t.prototype.intercept=function(t){var n=this,o=new e.CurrentInterceptContext;_.some(this.interceptionStrategies(),function(r){return e.InterceptionAction.Stop===r.handleIntercept(t,n.interceptorContext,o)?!0:void 0})},t.prototype.addCall=function(e){this._interceptorContext.addOrderedCall(e)},t.prototype.verifyCall=function(e,t){var n=this._interceptorContext.actualInvocations(),o=_.filter(n,function(t){return e.matches(t)}).length;t.verify(o)||this.throwVerifyCallException(e.setupCall,t)},t.prototype.verify=function(){var t=this._interceptorContext.orderedCalls(),n=_.filter(t,function(e){return e.isVerifiable}),o=_.filter(t,function(e){return e.isVerifiable&&e.isInvoked}),r=e.Times.exactly(n.length);r.verify(o.length)||this.throwVerifyException(n,r)},t.prototype.interceptionStrategies=function(){var t=[new e.AddActualInvocation,new e.ExtractProxyCall,new e.ExecuteCall,new e.InvokeBase,new e.HandleMockRecursion];return t},t.prototype.throwVerifyCallException=function(e,t){var n=new error.MockException(error.MockExceptionReason.VerificationFailed,e,"VerifyCall Exception",t.failMessage);throw n},t.prototype.throwVerifyException=function(e,t){var n=new error.MockException(error.MockExceptionReason.VerificationFailed,e,"Verify Exception",t.failMessage);throw n},t}();e.InterceptorExecute=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(){}return Object.defineProperty(e.prototype,"interceptedCall",{get:function(){return this._interceptedCall},enumerable:!0,configurable:!0}),e.prototype.intercept=function(e){if(this._interceptedCall)throw new error.MockException(error.MockExceptionReason.MoreThanOneSetupExpression,e,"MoreThanOneSetupExpression Exception","Setup should contain only one expression");this._interceptedCall=e},e}();e.InterceptorSetup=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function t(){}return t.prototype.handleIntercept=function(t,n,o){return n.addInvocation(t),e.InterceptionAction.Continue},t}();e.AddActualInvocation=t;var n=function(){function t(){}return t.prototype.handleIntercept=function(t,n,o){var r=n.orderedCalls().slice(),i=function(e){return e.matches(t)},c=_.filter(r,function(e){return i(e)});if(c.length>1&&(i=function(e){return!e.isInvoked&&e.matches(t)}),o.call=_.find(r,function(e){return i(e)}),null!=o.call)o.call.evaluatedSuccessfully();else if(n.behavior==e.MockBehavior.Strict)throw new error.MockException(error.MockExceptionReason.NoSetup,t);return e.InterceptionAction.Continue},t}();e.ExtractProxyCall=n;var o=function(){function t(){}return t.prototype.handleIntercept=function(t,n,o){this._ctx=n;var r=o.call;return null!=r?(r.execute(t),e.InterceptionAction.Stop):e.InterceptionAction.Continue},t}();e.ExecuteCall=o;var r=function(){function t(){}return t.prototype.handleIntercept=function(t,n,o){return n.mock.callBase?(t.invokeBase(),e.InterceptionAction.Stop):e.InterceptionAction.Continue},t}();e.InvokeBase=r;var i=function(){function t(){}return t.prototype.handleIntercept=function(t,n,o){return e.InterceptionAction.Continue},t}();e.HandleMockRecursion=i}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(){}return e.isValue=function(e){var t=new match.MatchValue(e);return t},e.isAnyObject=function(e){var t=new match.MatchAnyObject(e);return t},e.isAny=function(){var e=new match.MatchAny;return e},e.isAnyString=function(){var e=new match.MatchAnyString;return e},e.isAnyNumber=function(){var e=new match.MatchAnyNumber;return e},e}();e.It=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function t(t,n){this.mock=t,this._setupExpression=n,this._id=this.generateId();var o=new e.InterceptorSetup,r=e.Mock.proxyFactory.createProxy(o,t.instance);if(n(r),!o.interceptedCall)throw new error.MockException(error.MockExceptionReason.InvalidSetupExpression,this._setupExpression,"InvalidSetupExpression Exception","Invalid setup expression");var i=o.interceptedCall,c=this.transformToMatchers(i.args);Object.defineProperty(c,"callee",{configurable:!1,enumerable:!0,writable:!1,value:i.args.callee}),i.args=c,this._setupCall=i}return t.prototype.generateId=function(){return"MethodCall<"+_.uniqueId()+">"},t.prototype.transformToMatchers=function(t){var n=[];return _.each(t,function(t){if(_.isObject(t)){if(_.isUndefined(t[e.Cons.IMATCH_MATCHES_NAME])||_.isUndefined(t[e.Cons.IMATCH_ID_NAME])||t[e.Cons.IMATCH_ID_NAME]!==e.Cons.IMATCH_ID_VALUE)throw new error.MockException(error.MockExceptionReason.InvalidMatcher,t,"InvalidMatcher Exception","Invalid match object");n.push(t)}else{var o=new match.MatchValue(t);n.push(o)}}),n},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callCount",{get:function(){return this._callCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"setupExpression",{get:function(){return this._setupExpression},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"setupCall",{get:function(){return this._setupCall},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVerifiable",{get:function(){return this._isVerifiable},enumerable:!0,configurable:!0}),t.prototype.evaluatedSuccessfully=function(){this._evaluatedSuccessfully=!0},t.prototype.matches=function(e){var t=!1;return this._setupCall.property&&e&&e.property&&this._setupCall.property.name===e.property.name&&this._setupCall.args.length===e.args.length&&(t=!0,_.each(this.setupCall.args,function(n,o){var r=n,i=e.args[o];t&&!r.___matches(i)&&(t=!1)})),t},t.prototype.execute=function(t){if(this.isInvoked=!0,null!=this._setupCallback&&this._setupCallback.apply(this,t.args),null!=this._thrownException)throw this._thrownException;if(this._callCount++,this._isOnce){var n=e.Times.atMostOnce();if(!n.verify(this._callCount))throw new error.MockException(error.MockExceptionReason.MoreThanOneCall,this,"MoreThanOneCall Exception",n.failMessage)}if(this._expectedCallCount){var n=e.Times.exactly(this._expectedCallCount);if(!n.verify(this._callCount))throw new error.MockException(error.MockExceptionReason.MoreThanNCalls,this,"MoreThanNCalls Exception",n.failMessage)}},t.prototype.verifiable=function(e){this._isVerifiable=!0,null!=e&&(this.failMessage=e)},t}();e.MethodCall=t}(TypeMoq||(TypeMoq={}));var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},TypeMoq;!function(e){var t=function(e){function t(t,n){e.call(this,t,n)}return __extends(t,e),t.prototype.execute=function(t){e.prototype.execute.call(this,t),this._callBase?t.invokeBase():this.hasReturnValue&&(t.returnValue=this._returnValueFunc.apply(this,t.args))},t.prototype.callback=function(e){return this._setupCallback=e,this},t.prototype["throws"]=function(e){return this._thrownException=e,this},t.prototype.returns=function(e){return this._returnValueFunc=e,this.hasReturnValue=!0,this},t.prototype.callBase=function(){return this._callBase=!0,this},t}(e.MethodCall);e.MethodCallReturn=t}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){!function(e){e[e.Loose=0]="Loose",e[e.Strict=1]="Strict"}(e.MockBehavior||(e.MockBehavior={}));var t=e.MockBehavior,n=function(){function n(o,r){void 0===r&&(r=t.Loose),this.instance=o,this._behavior=r,this._id=this.generateId(),this._name=this.getNameOf(o),this._interceptor=new e.InterceptorExecute(this._behavior,this),this._proxy=n.proxyFactory.createProxy(this._interceptor,o)}return n.ofInstance=function(e,o){void 0===o&&(o=t.Loose);var r=new n(e,o);return r},n.ofType=function(e,o){void 0===o&&(o=t.Loose);for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var c=n.ofType2(e,r,o);return c},n.ofType2=function(o,r,i){void 0===i&&(i=t.Loose);var c=e.Utils.conthunktor(o,r),a=new n(c,i);return a},Object.defineProperty(n.prototype,"object",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"behavior",{get:function(){return this._behavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this._callBase},set:function(e){this._callBase=e},enumerable:!0,configurable:!0}),n.prototype.generateId=function(){return"Mock<"+_.uniqueId()+">"},n.prototype.getNameOf=function(t){var n;if(_.isFunction(t))n=e.Utils.functionName(t);else if(_.isObject(t)){var o=t.constructor;n=e.Utils.functionName(o)}return n&&(n=n.trim()),n},n.prototype.setup=function(t){var n=new e.MethodCallReturn(this,t);return this._interceptor.addCall(n),n},n.prototype.verify=function(t,n){var o=new e.MethodCall(this,t);this._interceptor.addCall(o);try{this._interceptor.verifyCall(o,n)}catch(r){throw r}},n.prototype.verifyAll=function(){try{this._interceptor.verify()}catch(e){throw e}},n.proxyFactory=new e.Proxy.ProxyFactory,n}();e.Mock=n}(TypeMoq||(TypeMoq={}));var TypeMoq;!function(e){var t=function(){function e(e,t,n,o){this._condition=e,this._from=t,this._to=n,this._failMessage=_.template(o)}return Object.defineProperty(e.prototype,"failMessage",{get:function(){return this._failMessage({n:this._from,m:this._lastCallCount})},enumerable:!0,configurable:!0}),e.prototype.verify=function(e){return this._lastCallCount=e,this._condition(e)},e.exactly=function(t){return new e(function(e){return e===t},t,t,e.NO_MATCHING_CALLS_EXACTLY_N_TIMES)},e.never=function(){return e.exactly(0)},e.once=function(){return e.exactly(1)},e.atLeastOnce=function(){return new e(function(e){return e>=1},1,Number.MAX_VALUE,e.NO_MATCHING_CALLS_AT_LEAST_ONCE)},e.atMostOnce=function(){return new e(function(e){return e>=0&&1>=e},0,1,e.NO_MATCHING_CALLS_AT_MOST_ONCE)},e.NO_MATCHING_CALLS_EXACTLY_N_TIMES="Expected invocation on the mock <%= n %> times, invoked <%= m %> times",e.NO_MATCHING_CALLS_AT_LEAST_ONCE="Expected invocation on the mock at least once",e.NO_MATCHING_CALLS_AT_MOST_ONCE="Expected invocation on the mock at most once",e}();e.Times=t}(TypeMoq||(TypeMoq={}));var error=TypeMoq.Error,match=TypeMoq.Match,proxy=TypeMoq.Proxy,TypeMoq;!function(e){var t=function(){function t(e){this._args=e}return t.using=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];var o=new t(e);return o},t.prototype["with"]=function(t){var n=[];try{_.each(this._args,function(t){if(!_.isUndefined(t.container[t.name])){var o=e.PropertyRetriever.getOwnAndPrototypeEnumerablesAndNonenumerables(t.container),r=_.find(o,function(e){return e.name===t.name});n[t.name]=r.desc;var i={};switch(t.type){case e.GlobalType.Class:i.value=function(){return t.mock.object};break;case e.GlobalType.Function:i.value=t.mock.object;break;case e.GlobalType.Value:i.get=function(){return t.mock.object};break;default:throw new error.MockException(error.MockExceptionReason.UnknownGlobalType,t,"UnknownGlobalType Exception","unknown global type: "+t.type)}try{Object.defineProperty(t.container,t.name,i)}catch(c){console.log("1: "+c)}}}),t.apply(this,this._args)}finally{_.each(this._args,function(t){if(!_.isUndefined(t.mock.instance)){var o=n[t.name];if(o){switch(t.type){case e.GlobalType.Class:break;case e.GlobalType.Function:break;case e.GlobalType.Value:o.configurable=!0}try{Object.defineProperty(t.container,t.name,o)}catch(r){console.log("2: "+r)}}}})}},t}();e.GlobalScope=t}(TypeMoq||(TypeMoq={}));var TypeMoqStatic;if(function(e){e.Mock=TypeMoq.Mock,e.MockBehavior=TypeMoq.MockBehavior,e.It=TypeMoq.It,e.Times=TypeMoq.Times,e.GlobalMock=TypeMoq.GlobalMock,e.GlobalScope=TypeMoq.GlobalScope,e.MockException=TypeMoq.Error.MockException}(TypeMoqStatic||(TypeMoqStatic={})),typemoq=TypeMoqStatic,"undefined"!=typeof require)var _=require("underscore");"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=typemoq),exports.typemoq=typemoq):this.typemoq=typemoq; | ||
var TypeMoqIntern;!function(e){var t=function(){function e(){}return e.IMATCH_ID_VALUE="438A51D3-6864-49D7-A655-CA1153B86965",e.IMATCH_ID_NAME="___id",e.IMATCH_MATCHES_NAME="___matches",e}();e.Cons=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(){}return e}();e.CurrentInterceptContext=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){!function(e){e[e.Class=0]="Class",e[e.Function=1]="Function",e[e.Value=2]="Value"}(e.GlobalType||(e.GlobalType={}));var t=e.GlobalType,n=function(){function n(e,t,n,r){this.mock=e,this._name=t,this._type=n,this.container=r}return n.ofInstance=function(r,o,i,c){void 0===i&&(i=window),void 0===c&&(c=e.MockBehavior.Loose);var a=e.Mock.ofInstance(r,c),u=_.isFunction(r)?t.Function:t.Value;return new n(a,o,u,i)},n.ofType=function(r,o,i,c){void 0===i&&(i=window),void 0===c&&(c=e.MockBehavior.Loose);var a=new r,u=e.Mock.ofInstance(a,c);return new n(u,o,t.Class,i)},Object.defineProperty(n.prototype,"object",{get:function(){return this.mock.object},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name||this.mock.name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"behavior",{get:function(){return this.mock.behavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this.mock.callBase},set:function(e){this.mock.callBase=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),n.prototype.setup=function(e){return this.mock.setup(e)},n.prototype.verify=function(e,t){this.mock.verify(e,t)},n.prototype.verifyAll=function(){this.mock.verifyAll()},n}();e.GlobalMock=n}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(){}return e.getOwnEnumerables=function(e){return this._getPropertyNames(e,!0,!1,this._enumerable)},e.getOwnNonenumerables=function(e){return this._getPropertyNames(e,!0,!1,this._notEnumerable)},e.getOwnEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!0,!1,this._enumerableAndNotEnumerable)},e.getPrototypeEnumerables=function(e){return this._getPropertyNames(e,!1,!0,this._enumerable)},e.getPrototypeNonenumerables=function(e){return this._getPropertyNames(e,!1,!0,this._notEnumerable)},e.getPrototypeEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!1,!0,this._enumerableAndNotEnumerable)},e.getOwnAndPrototypeEnumerables=function(e){return this._getPropertyNames(e,!0,!0,this._enumerable)},e.getOwnAndPrototypeNonenumerables=function(e){return this._getPropertyNames(e,!0,!0,this._notEnumerable)},e.getOwnAndPrototypeEnumerablesAndNonenumerables=function(e){return this._getPropertyNames(e,!0,!0,this._enumerableAndNotEnumerable)},e._enumerable=function(e,t){return e.propertyIsEnumerable(t)},e._notEnumerable=function(e,t){return!e.propertyIsEnumerable(t)},e._enumerableAndNotEnumerable=function(e,t){return!0},e._getPropertyNames=function(e,t,n,r){var o=[];do{if(t){var i=Object.getOwnPropertyNames(e);_.forEach(i,function(t){var n=_.find(o,function(e){return e.name===t});if(!n&&r(e,t)){var i=Object.getOwnPropertyDescriptor(e,t);o.push({name:t,desc:i})}})}if(!n)break;t=!0}while(e=Object.getPrototypeOf(e));return o},e}();e.PropertyRetriever=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(){}return e.getUUID=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)});return t},e.functionName=function(e){var t=e.toString();return t=t.substr("function ".length),t=t.substr(0,t.indexOf("("))},e.conthunktor=function(e,t){return function(){var n,r,o=function(){};return o.prototype=e.prototype,n=new o,_.isFunction(e)&&(r=e.apply(n,t)),_.isObject(r)?r:n}()},e}();e.Utils=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(e){var t=function(){function e(e,t){this.name=e,this.message=t,this.name=e}return e.prototype.toString=function(){return this.name},e}();e.Exception=t}(t=e.Error||(e.Error={}))}(TypeMoqIntern||(TypeMoqIntern={}));var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},TypeMoqIntern;!function(e){var t;!function(e){!function(e){e[e.NoSetup=0]="NoSetup",e[e.MoreThanOneSetupExpression=1]="MoreThanOneSetupExpression",e[e.InvalidSetupExpression=2]="InvalidSetupExpression",e[e.InvalidMatcher=3]="InvalidMatcher",e[e.InvalidProxyArgument=4]="InvalidProxyArgument",e[e.UnknownGlobalType=5]="UnknownGlobalType",e[e.VerificationFailed=6]="VerificationFailed",e[e.MoreThanOneCall=7]="MoreThanOneCall",e[e.MoreThanNCalls=8]="MoreThanNCalls"}(e.MockExceptionReason||(e.MockExceptionReason={}));var t=(e.MockExceptionReason,function(e){function t(t,n,r,o){void 0===r&&(r="Mock Exception"),e.call(this,r,o),this.reason=t,this.ctx=n}return __extends(t,e),t}(e.Exception));e.MockException=t}(t=e.Error||(e.Error={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(t){var n=function(){function t(t){this._ctor=t,this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return this._ctor.prototype===e.constructor.prototype&&(t=!0),t},t}();t.MatchAnyObject=n;var r=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isUndefined(e)||(t=!0),t},t}();t.MatchAny=r;var o=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isString(e)&&(t=!0),t},t}();t.MatchAnyString=o;var i=function(){function t(){this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isNumber(e)&&(t=!0),t},t}();t.MatchAnyNumber=i}(t=e.Match||(e.Match={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(t){var n=function(){function t(t){this._value=t,this.___id=e.Cons.IMATCH_ID_VALUE}return t.prototype.___matches=function(e){var t=!1;return _.isEqual(this._value,e)&&(t=!0),t},t}();t.MatchValue=n}(t=e.Match||(e.Match={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(e){var t=function(){function e(e,t){this._property=e,this._args=t}return Object.defineProperty(e.prototype,"args",{get:function(){return this._args||{length:0,callee:null}},set:function(e){this._args=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.toFunc.apply(this._property.obj,this._args)},e}();e.MethodInvocation=t;var n=function(){function e(e,t){this._property=e,this.returnValue=t}return Object.defineProperty(e.prototype,"args",{get:function(){var e=[];return Object.defineProperty(e,"callee",{configurable:!1,enumerable:!0,writable:!1,value:null}),e},set:function(e){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){},e}();e.GetterInvocation=n;var r=function(){function e(e,t){this._property=e,this._args=t}return Object.defineProperty(e.prototype,"args",{get:function(){return this._args},set:function(e){this._args=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"property",{get:function(){return this._property},enumerable:!0,configurable:!0}),e.prototype.invokeBase=function(){this.returnValue=this._property.obj[this._property.name]=this._args[0]},e}();e.SetterInvocation=r;var o=function(){function e(e,t){this.obj=e,this.name=t}return Object.defineProperty(e.prototype,"toFunc",{get:function(){var e;return e=_.isFunction(this.obj)?this.obj:this.obj[this.name]},enumerable:!0,configurable:!0}),e}();e.MethodInfo=o;var i=function(){function e(e,t){this.obj=e,this.name=t}return e}();e.PropertyInfo=i}(t=e.Proxy||(e.Proxy={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(t){var n=function(){function n(t,n){var r=this;this.check(n);var o=this,i=e.PropertyRetriever.getOwnAndPrototypeEnumerablesAndNonenumerables(n);_.each(i,function(e){if(_.isFunction(e.desc.value)){var i={configurable:e.desc.configurable,enumerable:e.desc.enumerable,writable:e.desc.writable};r.defineMethodProxy(o,t,n,e.name,i)}else{var i={configurable:e.desc.configurable,enumerable:e.desc.enumerable};r.definePropertyProxy(o,t,n,e.name,e.desc.value,i)}})}return n.of=function(t,r){n.check(t);var o;if(_.isFunction(t)){var i=e.Utils.functionName(t);o=n.methodProxyValue(r,t,i)}else o=new n(r,t);return o},n.check=function(e){n.checkNotNull(e);var t=!1;if((_.isFunction(e)||_.isObject(e)&&!n.isPrimitiveObject(e))&&(t=!0),!t)throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument should be a function or a non primitive object")},n.prototype.check=function(e){n.checkNotNull(e);var t=!1;if(_.isFunction(e)||!_.isObject(e)||n.isPrimitiveObject(e)||(t=!0),!t)throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument should be a non primitive object")},n.checkNotNull=function(e){if(_.isNull(e))throw new error.MockException(error.MockExceptionReason.InvalidProxyArgument,e,"InvalidProxyArgument Exception","Argument cannot be null")},n.isPrimitiveObject=function(e){var t=!1;return(_.isFunction(e)||_.isArray(e)||_.isDate(e)||_.isNull(e))&&(t=!0),t},n.prototype.defineMethodProxy=function(e,t,r,o,i){void 0===i&&(i={configurable:!1,enumerable:!0,writable:!1}),i.value=n.methodProxyValue(t,r,o),this.defineProperty(e,o,i)},n.methodProxyValue=function(e,n,r){function o(){var o=new t.MethodInfo(n,r),i=new t.MethodInvocation(o,arguments);return e.intercept(i),i.returnValue}return o},n.prototype.definePropertyProxy=function(e,n,r,o,i,c){function a(){var e=new t.PropertyInfo(r,o),c=new t.GetterInvocation(e,i);return n.intercept(c),c.returnValue}function u(e){var i=new t.PropertyInfo(r,o),c=new t.SetterInvocation(i,arguments);n.intercept(c)}void 0===c&&(c={configurable:!1,enumerable:!0}),c.get=a,c.set=u,this.defineProperty(e,o,c)},n.prototype.defineProperty=function(e,t,n){try{Object.defineProperty(e,t,n)}catch(r){console.log(r.message)}},n}();t.Proxy=n}(t=e.Proxy||(e.Proxy={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t;!function(e){var t=function(){function t(){}return t.prototype.createProxy=function(t,n){var r=e.Proxy.of(n,t);return r},t}();e.ProxyFactory=t}(t=e.Proxy||(e.Proxy={}))}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){!function(e){e[e.Continue=0]="Continue",e[e.Stop=1]="Stop"}(e.InterceptionAction||(e.InterceptionAction={}));var t=(e.InterceptionAction,function(){function e(e,t){this.behavior=e,this.mock=t,this._actualInvocations=[],this._orderedCalls=[]}return e.prototype.addInvocation=function(e){this._actualInvocations.push(e)},e.prototype.actualInvocations=function(){return this._actualInvocations},e.prototype.clearInvocations=function(){this._actualInvocations=[]},e.prototype.addOrderedCall=function(e){this._orderedCalls.push(e)},e.prototype.removeOrderedCall=function(e){_.filter(this._orderedCalls,function(t){return t.id!==e.id})},e.prototype.orderedCalls=function(){return this._orderedCalls},e}());e.InterceptorContext=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function t(t,n){this._interceptorContext=new e.InterceptorContext(t,n)}return Object.defineProperty(t.prototype,"interceptorContext",{get:function(){return this._interceptorContext},enumerable:!0,configurable:!0}),t.prototype.intercept=function(t){var n=this,r=new e.CurrentInterceptContext;_.some(this.interceptionStrategies(),function(o){return e.InterceptionAction.Stop===o.handleIntercept(t,n.interceptorContext,r)?!0:void 0})},t.prototype.addCall=function(e){this._interceptorContext.addOrderedCall(e)},t.prototype.verifyCall=function(e,t){var n=this._interceptorContext.actualInvocations(),r=_.filter(n,function(t){return e.matches(t)}).length;t.verify(r)||this.throwVerifyCallException(e.setupCall,t)},t.prototype.verify=function(){var t=this._interceptorContext.orderedCalls(),n=_.filter(t,function(e){return e.isVerifiable}),r=_.filter(t,function(e){return e.isVerifiable&&e.isInvoked}),o=e.Times.exactly(n.length);o.verify(r.length)||this.throwVerifyException(n,o)},t.prototype.interceptionStrategies=function(){var t=[new e.AddActualInvocation,new e.ExtractProxyCall,new e.ExecuteCall,new e.InvokeBase,new e.HandleMockRecursion];return t},t.prototype.throwVerifyCallException=function(e,t){var n=new error.MockException(error.MockExceptionReason.VerificationFailed,e,"VerifyCall Exception",t.failMessage);throw n},t.prototype.throwVerifyException=function(e,t){var n=new error.MockException(error.MockExceptionReason.VerificationFailed,e,"Verify Exception",t.failMessage);throw n},t}();e.InterceptorExecute=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(){}return Object.defineProperty(e.prototype,"interceptedCall",{get:function(){return this._interceptedCall},enumerable:!0,configurable:!0}),e.prototype.intercept=function(e){if(this._interceptedCall)throw new error.MockException(error.MockExceptionReason.MoreThanOneSetupExpression,e,"MoreThanOneSetupExpression Exception","Setup should contain only one expression");this._interceptedCall=e},e}();e.InterceptorSetup=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function t(){}return t.prototype.handleIntercept=function(t,n,r){return n.addInvocation(t),e.InterceptionAction.Continue},t}();e.AddActualInvocation=t;var n=function(){function t(){}return t.prototype.handleIntercept=function(t,n,r){var o=n.orderedCalls().slice(),i=function(e){return e.matches(t)},c=_.filter(o,function(e){return i(e)});if(c.length>1&&(i=function(e){return!e.isInvoked&&e.matches(t)}),r.call=_.find(o,function(e){return i(e)}),null!=r.call)r.call.evaluatedSuccessfully();else if(n.behavior==e.MockBehavior.Strict)throw new error.MockException(error.MockExceptionReason.NoSetup,t);return e.InterceptionAction.Continue},t}();e.ExtractProxyCall=n;var r=function(){function t(){}return t.prototype.handleIntercept=function(t,n,r){this._ctx=n;var o=r.call;return null!=o?(o.execute(t),e.InterceptionAction.Stop):e.InterceptionAction.Continue},t}();e.ExecuteCall=r;var o=function(){function t(){}return t.prototype.handleIntercept=function(t,n,r){return n.mock.callBase?(t.invokeBase(),e.InterceptionAction.Stop):e.InterceptionAction.Continue},t}();e.InvokeBase=o;var i=function(){function t(){}return t.prototype.handleIntercept=function(t,n,r){return e.InterceptionAction.Continue},t}();e.HandleMockRecursion=i}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(){}return e.isValue=function(e){var t=new match.MatchValue(e);return t},e.isAnyObject=function(e){var t=new match.MatchAnyObject(e);return t},e.isAny=function(){var e=new match.MatchAny;return e},e.isAnyString=function(){var e=new match.MatchAnyString;return e},e.isAnyNumber=function(){var e=new match.MatchAnyNumber;return e},e}();e.It=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function t(t,n){this.mock=t,this._setupExpression=n,this._id=this.generateId();var r=new e.InterceptorSetup,o=e.Mock.proxyFactory.createProxy(r,t.instance);if(n(o),!r.interceptedCall)throw new error.MockException(error.MockExceptionReason.InvalidSetupExpression,this._setupExpression,"InvalidSetupExpression Exception","Invalid setup expression");var i=r.interceptedCall,c=this.transformToMatchers(i.args);Object.defineProperty(c,"callee",{configurable:!1,enumerable:!0,writable:!1,value:i.args.callee}),i.args=c,this._setupCall=i}return t.prototype.generateId=function(){return"MethodCall<"+_.uniqueId()+">"},t.prototype.transformToMatchers=function(t){var n=[];return _.each(t,function(t){if(_.isObject(t)){if(_.isUndefined(t[e.Cons.IMATCH_MATCHES_NAME])||_.isUndefined(t[e.Cons.IMATCH_ID_NAME])||t[e.Cons.IMATCH_ID_NAME]!==e.Cons.IMATCH_ID_VALUE)throw new error.MockException(error.MockExceptionReason.InvalidMatcher,t,"InvalidMatcher Exception","Invalid match object");n.push(t)}else{var r=new match.MatchValue(t);n.push(r)}}),n},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callCount",{get:function(){return this._callCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"setupExpression",{get:function(){return this._setupExpression},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"setupCall",{get:function(){return this._setupCall},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVerifiable",{get:function(){return this._isVerifiable},enumerable:!0,configurable:!0}),t.prototype.evaluatedSuccessfully=function(){this._evaluatedSuccessfully=!0},t.prototype.matches=function(e){var t=!1;return this._setupCall.property&&e&&e.property&&this._setupCall.property.name===e.property.name&&this._setupCall.args.length===e.args.length&&(t=!0,_.each(this.setupCall.args,function(n,r){var o=n,i=e.args[r];t&&!o.___matches(i)&&(t=!1)})),t},t.prototype.execute=function(t){if(this.isInvoked=!0,null!=this._setupCallback&&this._setupCallback.apply(this,t.args),null!=this._thrownException)throw this._thrownException;if(this._callCount++,this._isOnce){var n=e.Times.atMostOnce();if(!n.verify(this._callCount))throw new error.MockException(error.MockExceptionReason.MoreThanOneCall,this,"MoreThanOneCall Exception",n.failMessage)}if(this._expectedCallCount){var n=e.Times.exactly(this._expectedCallCount);if(!n.verify(this._callCount))throw new error.MockException(error.MockExceptionReason.MoreThanNCalls,this,"MoreThanNCalls Exception",n.failMessage)}},t.prototype.verifiable=function(e){this._isVerifiable=!0,null!=e&&(this.failMessage=e)},t}();e.MethodCall=t}(TypeMoqIntern||(TypeMoqIntern={}));var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},TypeMoqIntern;!function(e){var t=function(e){function t(t,n){e.call(this,t,n)}return __extends(t,e),t.prototype.execute=function(t){e.prototype.execute.call(this,t),this._callBase?t.invokeBase():this.hasReturnValue&&(t.returnValue=this._returnValueFunc.apply(this,t.args))},t.prototype.callback=function(e){return this._setupCallback=e,this},t.prototype["throws"]=function(e){return this._thrownException=e,this},t.prototype.returns=function(e){return this._returnValueFunc=e,this.hasReturnValue=!0,this},t.prototype.callBase=function(){return this._callBase=!0,this},t}(e.MethodCall);e.MethodCallReturn=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){!function(e){e[e.Loose=0]="Loose",e[e.Strict=1]="Strict"}(e.MockBehavior||(e.MockBehavior={}));var t=e.MockBehavior,n=function(){function n(r,o){void 0===o&&(o=t.Loose),this.instance=r,this._behavior=o,this._id=this.generateId(),this._name=this.getNameOf(r),this._interceptor=new e.InterceptorExecute(this._behavior,this),this._proxy=n.proxyFactory.createProxy(this._interceptor,r)}return n.ofInstance=function(e,r){void 0===r&&(r=t.Loose);var o=new n(e,r);return o},n.ofType=function(e,r){void 0===r&&(r=t.Loose);for(var o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];var c=n.ofType2(e,o,r);return c},n.ofType2=function(r,o,i){void 0===i&&(i=t.Loose);var c=e.Utils.conthunktor(r,o),a=new n(c,i);return a},Object.defineProperty(n.prototype,"object",{get:function(){return this._proxy},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"behavior",{get:function(){return this._behavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"callBase",{get:function(){return this._callBase},set:function(e){this._callBase=e},enumerable:!0,configurable:!0}),n.prototype.generateId=function(){return"Mock<"+_.uniqueId()+">"},n.prototype.getNameOf=function(t){var n;if(_.isFunction(t))n=e.Utils.functionName(t);else if(_.isObject(t)){var r=t.constructor;n=e.Utils.functionName(r)}return n&&(n=n.trim()),n},n.prototype.setup=function(t){var n=new e.MethodCallReturn(this,t);return this._interceptor.addCall(n),n},n.prototype.verify=function(t,n){var r=new e.MethodCall(this,t);this._interceptor.addCall(r);try{this._interceptor.verifyCall(r,n)}catch(o){throw o}},n.prototype.verifyAll=function(){try{this._interceptor.verify()}catch(e){throw e}},n.proxyFactory=new e.Proxy.ProxyFactory,n}();e.Mock=n}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoqIntern;!function(e){var t=function(){function e(e,t,n,r){this._condition=e,this._from=t,this._to=n,this._failMessage=_.template(r)}return Object.defineProperty(e.prototype,"failMessage",{get:function(){return this._failMessage({n:this._from,m:this._lastCallCount})},enumerable:!0,configurable:!0}),e.prototype.verify=function(e){return this._lastCallCount=e,this._condition(e)},e.exactly=function(t){return new e(function(e){return e===t},t,t,e.NO_MATCHING_CALLS_EXACTLY_N_TIMES)},e.never=function(){return e.exactly(0)},e.once=function(){return e.exactly(1)},e.atLeastOnce=function(){return new e(function(e){return e>=1},1,Number.MAX_VALUE,e.NO_MATCHING_CALLS_AT_LEAST_ONCE)},e.atMostOnce=function(){return new e(function(e){return e>=0&&1>=e},0,1,e.NO_MATCHING_CALLS_AT_MOST_ONCE)},e.NO_MATCHING_CALLS_EXACTLY_N_TIMES="Expected invocation on the mock <%= n %> times, invoked <%= m %> times",e.NO_MATCHING_CALLS_AT_LEAST_ONCE="Expected invocation on the mock at least once",e.NO_MATCHING_CALLS_AT_MOST_ONCE="Expected invocation on the mock at most once",e}();e.Times=t}(TypeMoqIntern||(TypeMoqIntern={}));var error=TypeMoqIntern.Error,match=TypeMoqIntern.Match,proxy=TypeMoqIntern.Proxy,TypeMoqIntern;!function(e){var t=function(){function t(e){this._args=e}return t.using=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];var r=new t(e);return r},t.prototype["with"]=function(t){var n=[];try{_.each(this._args,function(t){if(!_.isUndefined(t.container[t.name])){var r=e.PropertyRetriever.getOwnAndPrototypeEnumerablesAndNonenumerables(t.container),o=_.find(r,function(e){return e.name===t.name});n[t.name]=o.desc;var i={};switch(t.type){case e.GlobalType.Class:i.value=function(){return t.mock.object};break;case e.GlobalType.Function:i.value=t.mock.object;break;case e.GlobalType.Value:i.get=function(){return t.mock.object};break;default:throw new error.MockException(error.MockExceptionReason.UnknownGlobalType,t,"UnknownGlobalType Exception","unknown global type: "+t.type)}try{Object.defineProperty(t.container,t.name,i)}catch(c){console.log("1: "+c)}}}),t.apply(this,this._args)}finally{_.each(this._args,function(t){if(!_.isUndefined(t.mock.instance)){var r=n[t.name];if(r){switch(t.type){case e.GlobalType.Class:break;case e.GlobalType.Function:break;case e.GlobalType.Value:r.configurable=!0}try{Object.defineProperty(t.container,t.name,r)}catch(o){console.log("2: "+o)}}}})}},t}();e.GlobalScope=t}(TypeMoqIntern||(TypeMoqIntern={}));var TypeMoq;if(function(e){e.Mock=TypeMoqIntern.Mock,e.MockBehavior=TypeMoqIntern.MockBehavior,e.It=TypeMoqIntern.It,e.Times=TypeMoqIntern.Times,e.GlobalMock=TypeMoqIntern.GlobalMock,e.GlobalScope=TypeMoqIntern.GlobalScope,e.MockException=TypeMoqIntern.Error.MockException}(TypeMoq||(TypeMoq={})),typemoq=TypeMoq,"undefined"!=typeof require)var _=require("underscore");"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=typemoq),exports.typemoq=typemoq):this.typemoq=typemoq; |
116
typemoq.d.ts
@@ -1,2 +0,2 @@ | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class Cons { | ||
@@ -10,3 +10,3 @@ static IMATCH_ID_VALUE: string; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class CurrentInterceptContext<T> { | ||
@@ -18,3 +18,3 @@ call: proxy.IProxyCall<T>; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
enum GlobalType { | ||
@@ -45,3 +45,3 @@ Class = 0, | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface ICallback<T, TResult> { | ||
@@ -54,3 +54,3 @@ callback(action: IAction): IReturnsThrows<T, TResult>; | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface IReturns<T, TResult> { | ||
@@ -67,3 +67,3 @@ returns(valueFunction: IFuncN<any, TResult>): IReturnsResult<T>; | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface ISetup<T, TResult> extends ICallback<T, TResult>, IReturnsThrows<T, TResult>, IVerifies { | ||
@@ -74,3 +74,3 @@ } | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface IThrows { | ||
@@ -84,3 +84,3 @@ throws<T extends error.Exception>(exception: T): IThrowsResult; | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface IUsingResult { | ||
@@ -92,3 +92,3 @@ with(action: IAction): void; | ||
declare module TypeMoq.Api { | ||
declare namespace TypeMoqIntern.Api { | ||
interface IVerifies { | ||
@@ -102,3 +102,3 @@ verifiable(failMessage?: string): void; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
interface Ctor<T> { | ||
@@ -115,3 +115,3 @@ new (): T; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
interface IAction { | ||
@@ -138,3 +138,3 @@ (): void; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class PropertyRetriever { | ||
@@ -185,3 +185,3 @@ static getOwnEnumerables(obj: any): { | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class Utils { | ||
@@ -197,3 +197,3 @@ static getUUID(): string; | ||
declare module TypeMoq.Error { | ||
declare namespace TypeMoqIntern.Error { | ||
class Exception implements Error { | ||
@@ -208,3 +208,3 @@ name: string; | ||
declare module TypeMoq.Error { | ||
declare namespace TypeMoqIntern.Error { | ||
enum MockExceptionReason { | ||
@@ -231,3 +231,3 @@ NoSetup = 0, | ||
declare module TypeMoq.Match { | ||
declare namespace TypeMoqIntern.Match { | ||
interface IMatch { | ||
@@ -240,3 +240,3 @@ ___id: string; | ||
declare module TypeMoq.Match { | ||
declare namespace TypeMoqIntern.Match { | ||
class MatchAnyObject<T> implements IMatch { | ||
@@ -263,3 +263,3 @@ private _ctor; | ||
declare module TypeMoq.Match { | ||
declare namespace TypeMoqIntern.Match { | ||
class MatchValue<T> implements IMatch { | ||
@@ -276,3 +276,3 @@ private _value; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface ICallContext { | ||
@@ -287,3 +287,3 @@ args: IArguments; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface ICallInterceptor { | ||
@@ -295,3 +295,3 @@ intercept(context: ICallContext): void; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
class MethodInvocation implements ICallContext { | ||
@@ -341,3 +341,3 @@ private _property; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface IProxyCall<T> { | ||
@@ -358,3 +358,3 @@ id: string; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface IProxyFactory { | ||
@@ -366,3 +366,3 @@ createProxy<T>(interceptor: ICallInterceptor, instance: T): T; | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
class Proxy<T> { | ||
@@ -383,3 +383,3 @@ constructor(interceptor: ICallInterceptor, instance: T); | ||
declare module TypeMoq.Proxy { | ||
declare namespace TypeMoqIntern.Proxy { | ||
class ProxyFactory implements IProxyFactory { | ||
@@ -393,3 +393,3 @@ createProxy<T>(interceptor: ICallInterceptor, instance: T): T; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
interface IGlobalMock<T> extends IMock<T> { | ||
@@ -403,3 +403,3 @@ mock: Mock<T>; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
interface IMock<T> { | ||
@@ -417,3 +417,3 @@ object: T; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
enum InterceptionAction { | ||
@@ -442,3 +442,3 @@ Continue = 0, | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class InterceptorExecute<T> implements Proxy.ICallInterceptor { | ||
@@ -459,3 +459,3 @@ private _interceptorContext; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class InterceptorSetup<T> implements Proxy.ICallInterceptor { | ||
@@ -469,3 +469,3 @@ private _interceptedCall; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class AddActualInvocation<T> implements IInterceptStrategy<T> { | ||
@@ -490,3 +490,3 @@ handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class It { | ||
@@ -502,3 +502,3 @@ static isValue<T>(x: T): T; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class MethodCall<T, TResult> implements proxy.IProxyCall<T>, api.IVerifies { | ||
@@ -534,3 +534,3 @@ mock: Mock<T>; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class MethodCallReturn<T, TResult> extends MethodCall<T, TResult> implements api.ISetup<T, TResult>, api.IReturnsResult<T> { | ||
@@ -550,3 +550,3 @@ protected _returnValueFunc: IFuncN<any, TResult>; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
enum MockBehavior { | ||
@@ -582,3 +582,3 @@ Loose = 0, | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class Times { | ||
@@ -605,9 +605,9 @@ private _condition; | ||
import api = TypeMoq.Api; | ||
import error = TypeMoq.Error; | ||
import match = TypeMoq.Match; | ||
import proxy = TypeMoq.Proxy; | ||
import api = TypeMoqIntern.Api; | ||
import error = TypeMoqIntern.Error; | ||
import match = TypeMoqIntern.Match; | ||
import proxy = TypeMoqIntern.Proxy; | ||
declare module TypeMoq { | ||
declare namespace TypeMoqIntern { | ||
class GlobalScope implements api.IUsingResult { | ||
@@ -622,21 +622,21 @@ private _args; | ||
interface ITypeMoqStatic { | ||
Mock: typeof TypeMoq.Mock; | ||
MockBehavior: typeof TypeMoq.MockBehavior; | ||
It: typeof TypeMoq.It; | ||
Times: typeof TypeMoq.Times; | ||
GlobalMock: typeof TypeMoq.GlobalMock; | ||
GlobalScope: typeof TypeMoq.GlobalScope; | ||
MockException: typeof TypeMoq.Error.MockException; | ||
interface ITypeMoq { | ||
Mock: typeof TypeMoqIntern.Mock; | ||
MockBehavior: typeof TypeMoqIntern.MockBehavior; | ||
It: typeof TypeMoqIntern.It; | ||
Times: typeof TypeMoqIntern.Times; | ||
GlobalMock: typeof TypeMoqIntern.GlobalMock; | ||
GlobalScope: typeof TypeMoqIntern.GlobalScope; | ||
MockException: typeof TypeMoqIntern.Error.MockException; | ||
} | ||
declare module TypeMoqStatic { | ||
export import Mock = TypeMoq.Mock; | ||
export import MockBehavior = TypeMoq.MockBehavior; | ||
export import It = TypeMoq.It; | ||
export import Times = TypeMoq.Times; | ||
export import GlobalMock = TypeMoq.GlobalMock; | ||
export import GlobalScope = TypeMoq.GlobalScope; | ||
export import MockException = TypeMoq.Error.MockException; | ||
declare module TypeMoq { | ||
export import Mock = TypeMoqIntern.Mock; | ||
export import MockBehavior = TypeMoqIntern.MockBehavior; | ||
export import It = TypeMoqIntern.It; | ||
export import Times = TypeMoqIntern.Times; | ||
export import GlobalMock = TypeMoqIntern.GlobalMock; | ||
export import GlobalScope = TypeMoqIntern.GlobalScope; | ||
export import MockException = TypeMoqIntern.Error.MockException; | ||
} | ||
declare var typemoq: ITypeMoqStatic; | ||
declare var typemoq: ITypeMoq; | ||
@@ -643,0 +643,0 @@ |
@@ -1,5 +0,610 @@ | ||
/// <reference path="./typemoq.d.ts" /> | ||
declare namespace TypeMoqIntern { | ||
class Cons { | ||
static IMATCH_ID_VALUE: string; | ||
static IMATCH_ID_NAME: string; | ||
static IMATCH_MATCHES_NAME: string; | ||
} | ||
} | ||
declare module "typemoq" { | ||
export = typemoq; | ||
} | ||
declare namespace TypeMoqIntern { | ||
class CurrentInterceptContext<T> { | ||
call: proxy.IProxyCall<T>; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
enum GlobalType { | ||
Class = 0, | ||
Function = 1, | ||
Value = 2, | ||
} | ||
class GlobalMock<T> implements IGlobalMock<T> { | ||
mock: Mock<T>; | ||
private _name; | ||
private _type; | ||
container: Object; | ||
constructor(mock: Mock<T>, _name: string, _type: GlobalType, container: Object); | ||
static ofInstance<U>(instance: U, name?: string, container?: Object, behavior?: MockBehavior): GlobalMock<U>; | ||
static ofType<U>(ctor: Ctor<U>, name?: string, container?: Object, behavior?: MockBehavior): GlobalMock<U>; | ||
object: T; | ||
name: string; | ||
behavior: MockBehavior; | ||
callBase: boolean; | ||
type: GlobalType; | ||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>; | ||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void; | ||
verifyAll(): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface ICallback<T, TResult> { | ||
callback(action: IAction): IReturnsThrows<T, TResult>; | ||
callback(action: IAction1<T>): IReturnsThrows<T, TResult>; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface IReturns<T, TResult> { | ||
returns(valueFunction: IFuncN<any, TResult>): IReturnsResult<T>; | ||
callBase(): IReturnsResult<T>; | ||
} | ||
interface IReturnsResult<T> extends IVerifies { | ||
} | ||
interface IReturnsThrows<T, TResult> extends IReturns<T, TResult>, IThrows { | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface ISetup<T, TResult> extends ICallback<T, TResult>, IReturnsThrows<T, TResult>, IVerifies { | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface IThrows { | ||
throws<T extends error.Exception>(exception: T): IThrowsResult; | ||
} | ||
interface IThrowsResult extends IVerifies { | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface IUsingResult { | ||
with(action: IAction): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Api { | ||
interface IVerifies { | ||
verifiable(failMessage?: string): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
interface Ctor<T> { | ||
new (): T; | ||
prototype: any; | ||
} | ||
interface CtorWithArgs<T> { | ||
new (...ctorArgs: any[]): T; | ||
prototype: any; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
interface IAction { | ||
(): void; | ||
} | ||
interface IAction1<T> { | ||
(x: T): void; | ||
} | ||
interface IActionN<T> { | ||
(...x: T[]): void; | ||
} | ||
interface IFunc1<TResult> { | ||
(): TResult; | ||
} | ||
interface IFunc2<T, TResult> { | ||
(x: T): TResult; | ||
} | ||
interface IFuncN<T, TResult> { | ||
(...x: T[]): TResult; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class PropertyRetriever { | ||
static getOwnEnumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getOwnNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getOwnEnumerablesAndNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getPrototypeEnumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getPrototypeNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getPrototypeEnumerablesAndNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getOwnAndPrototypeEnumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getOwnAndPrototypeNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
static getOwnAndPrototypeEnumerablesAndNonenumerables(obj: any): { | ||
name: string; | ||
desc: PropertyDescriptor; | ||
}[]; | ||
private static _enumerable(obj, prop); | ||
private static _notEnumerable(obj, prop); | ||
private static _enumerableAndNotEnumerable(obj, prop); | ||
private static _getPropertyNames(obj, iterateSelfBool, iteratePrototypeBool, includePropCb); | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class Utils { | ||
static getUUID(): string; | ||
static functionName(fun: any): any; | ||
static conthunktor<U>(ctor: CtorWithArgs<U>, args: any[]): U; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Error { | ||
class Exception implements Error { | ||
name: string; | ||
message: string; | ||
constructor(name?: string, message?: string); | ||
toString(): string; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Error { | ||
enum MockExceptionReason { | ||
NoSetup = 0, | ||
MoreThanOneSetupExpression = 1, | ||
InvalidSetupExpression = 2, | ||
InvalidMatcher = 3, | ||
InvalidProxyArgument = 4, | ||
UnknownGlobalType = 5, | ||
VerificationFailed = 6, | ||
MoreThanOneCall = 7, | ||
MoreThanNCalls = 8, | ||
} | ||
class MockException extends Exception { | ||
reason: MockExceptionReason; | ||
ctx: any; | ||
constructor(reason: MockExceptionReason, ctx: any, name?: string, message?: string); | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Match { | ||
interface IMatch { | ||
___id: string; | ||
___matches(object: Object): boolean; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Match { | ||
class MatchAnyObject<T> implements IMatch { | ||
private _ctor; | ||
___id: string; | ||
constructor(_ctor: Ctor<T>); | ||
___matches(object: Object): boolean; | ||
} | ||
class MatchAny implements IMatch { | ||
___id: string; | ||
___matches(object: Object): boolean; | ||
} | ||
class MatchAnyString implements IMatch { | ||
___id: string; | ||
___matches(object: Object): boolean; | ||
} | ||
class MatchAnyNumber implements IMatch { | ||
___id: string; | ||
___matches(object: Object): boolean; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Match { | ||
class MatchValue<T> implements IMatch { | ||
private _value; | ||
___id: string; | ||
constructor(_value: T); | ||
___matches(object: any): boolean; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface ICallContext { | ||
args: IArguments; | ||
property: IPropertyInfo; | ||
returnValue: any; | ||
invokeBase(): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface ICallInterceptor { | ||
intercept(context: ICallContext): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
class MethodInvocation implements ICallContext { | ||
private _property; | ||
private _args; | ||
returnValue: any; | ||
constructor(_property: MethodInfo, _args?: IArguments); | ||
args: IArguments; | ||
property: PropertyInfo; | ||
invokeBase(): void; | ||
} | ||
class GetterInvocation implements ICallContext { | ||
private _property; | ||
returnValue: any; | ||
constructor(_property: PropertyInfo, value: any); | ||
args: IArguments; | ||
property: PropertyInfo; | ||
invokeBase(): void; | ||
} | ||
class SetterInvocation implements ICallContext { | ||
private _property; | ||
private _args; | ||
returnValue: any; | ||
constructor(_property: PropertyInfo, _args: IArguments); | ||
args: IArguments; | ||
property: PropertyInfo; | ||
invokeBase(): void; | ||
} | ||
class MethodInfo implements IPropertyInfo { | ||
obj: Object; | ||
name: string; | ||
constructor(obj: Object, name: string); | ||
toFunc: Function; | ||
} | ||
class PropertyInfo implements IPropertyInfo { | ||
obj: Object; | ||
name: string; | ||
constructor(obj: Object, name: string); | ||
} | ||
interface IPropertyInfo { | ||
obj: Object; | ||
name: string; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface IProxyCall<T> { | ||
id: string; | ||
callCount: number; | ||
failMessage: string; | ||
isInvoked: boolean; | ||
isVerifiable: boolean; | ||
setupExpression: IAction1<T>; | ||
setupCall: proxy.ICallContext; | ||
evaluatedSuccessfully(): void; | ||
matches(call: proxy.ICallContext): boolean; | ||
execute(call: proxy.ICallContext): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
interface IProxyFactory { | ||
createProxy<T>(interceptor: ICallInterceptor, instance: T): T; | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
class Proxy<T> { | ||
constructor(interceptor: ICallInterceptor, instance: T); | ||
static of<U>(instance: U, interceptor: ICallInterceptor): any; | ||
private static check<U>(instance); | ||
private check<U>(instance); | ||
private static checkNotNull<U>(instance); | ||
private static isPrimitiveObject(obj); | ||
private defineMethodProxy(that, interceptor, instance, propName, propDesc?); | ||
private static methodProxyValue<U>(interceptor, instance, propName); | ||
private definePropertyProxy(that, interceptor, instance, propName, propValue, propDesc?); | ||
private defineProperty(obj, name, desc); | ||
} | ||
} | ||
declare namespace TypeMoqIntern.Proxy { | ||
class ProxyFactory implements IProxyFactory { | ||
createProxy<T>(interceptor: ICallInterceptor, instance: T): T; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
interface IGlobalMock<T> extends IMock<T> { | ||
mock: Mock<T>; | ||
type: GlobalType; | ||
container: Object; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
interface IMock<T> { | ||
object: T; | ||
name: string; | ||
behavior: MockBehavior; | ||
callBase: boolean; | ||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>; | ||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void; | ||
verifyAll(): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
enum InterceptionAction { | ||
Continue = 0, | ||
Stop = 1, | ||
} | ||
interface IInterceptStrategy<T> { | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
class InterceptorContext<T> { | ||
behavior: MockBehavior; | ||
mock: IMock<T>; | ||
private _actualInvocations; | ||
private _orderedCalls; | ||
constructor(behavior: MockBehavior, mock: IMock<T>); | ||
addInvocation(invocation: proxy.ICallContext): void; | ||
actualInvocations(): proxy.ICallContext[]; | ||
clearInvocations(): void; | ||
addOrderedCall(call: proxy.IProxyCall<T>): void; | ||
removeOrderedCall(call: proxy.IProxyCall<T>): void; | ||
orderedCalls(): proxy.IProxyCall<T>[]; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class InterceptorExecute<T> implements Proxy.ICallInterceptor { | ||
private _interceptorContext; | ||
constructor(behavior: MockBehavior, mock: IMock<T>); | ||
interceptorContext: InterceptorContext<T>; | ||
intercept(invocation: proxy.ICallContext): void; | ||
addCall(call: proxy.IProxyCall<T>): void; | ||
verifyCall<T, TResult>(call: MethodCall<T, TResult>, times: Times): void; | ||
verify(): void; | ||
private interceptionStrategies(); | ||
private throwVerifyCallException(call, times); | ||
private throwVerifyException(failures, times); | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class InterceptorSetup<T> implements Proxy.ICallInterceptor { | ||
private _interceptedCall; | ||
interceptedCall: proxy.ICallContext; | ||
intercept(invocation: proxy.ICallContext): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class AddActualInvocation<T> implements IInterceptStrategy<T> { | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
class ExtractProxyCall<T> implements IInterceptStrategy<T> { | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
class ExecuteCall<T> implements IInterceptStrategy<T> { | ||
private _ctx; | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
class InvokeBase<T> implements IInterceptStrategy<T> { | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
class HandleMockRecursion<T> implements IInterceptStrategy<T> { | ||
handleIntercept(invocation: proxy.ICallContext, ctx: InterceptorContext<T>, localCtx: CurrentInterceptContext<T>): InterceptionAction; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class It { | ||
static isValue<T>(x: T): T; | ||
static isAnyObject<T>(x: Ctor<T>): T; | ||
static isAny(): any; | ||
static isAnyString(): string; | ||
static isAnyNumber(): number; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class MethodCall<T, TResult> implements proxy.IProxyCall<T>, api.IVerifies { | ||
mock: Mock<T>; | ||
private _setupExpression; | ||
protected _id: string; | ||
protected _callCount: number; | ||
protected _expectedCallCount: number; | ||
protected _isOnce: boolean; | ||
protected _setupCallback: IAction; | ||
protected _setupCall: proxy.ICallContext; | ||
protected _thrownException: error.Exception; | ||
protected _isVerifiable: boolean; | ||
protected _evaluatedSuccessfully: boolean; | ||
failMessage: string; | ||
isInvoked: boolean; | ||
constructor(mock: Mock<T>, _setupExpression: IFunc2<T, TResult>); | ||
private generateId(); | ||
private transformToMatchers(args); | ||
id: string; | ||
callCount: number; | ||
setupExpression: IAction1<T>; | ||
setupCall: proxy.ICallContext; | ||
isVerifiable: boolean; | ||
evaluatedSuccessfully(): void; | ||
matches(call: proxy.ICallContext): boolean; | ||
execute(call: proxy.ICallContext): void; | ||
verifiable(failMessage?: string): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class MethodCallReturn<T, TResult> extends MethodCall<T, TResult> implements api.ISetup<T, TResult>, api.IReturnsResult<T> { | ||
protected _returnValueFunc: IFuncN<any, TResult>; | ||
hasReturnValue: boolean; | ||
protected _callBase: boolean; | ||
constructor(mock: Mock<T>, setupExpression: IFunc2<T, TResult>); | ||
execute(call: proxy.ICallContext): void; | ||
callback(action: IActionN<any>): api.IReturnsThrows<T, TResult>; | ||
throws(exception: Error): api.IThrowsResult; | ||
returns(valueFunc: IFuncN<any, TResult>): api.IReturnsResult<T>; | ||
callBase(): api.IReturnsResult<T>; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
enum MockBehavior { | ||
Loose = 0, | ||
Strict = 1, | ||
} | ||
class Mock<T> implements IMock<T> { | ||
instance: T; | ||
private _behavior; | ||
static proxyFactory: proxy.IProxyFactory; | ||
private _id; | ||
private _name; | ||
private _interceptor; | ||
private _proxy; | ||
private _callBase; | ||
constructor(instance: T, _behavior?: MockBehavior); | ||
static ofInstance<U>(instance: U, behavior?: MockBehavior): Mock<U>; | ||
static ofType<U>(ctor: CtorWithArgs<U>, behavior?: MockBehavior, ...ctorArgs: any[]): Mock<U>; | ||
static ofType2<U>(ctor: CtorWithArgs<U>, ctorArgs: any[], behavior?: MockBehavior): Mock<U>; | ||
object: T; | ||
name: string; | ||
behavior: MockBehavior; | ||
callBase: boolean; | ||
private generateId(); | ||
private getNameOf(instance); | ||
setup<TResult>(expression: IFunc2<T, TResult>): MethodCallReturn<T, TResult>; | ||
verify<TResult>(expression: IFunc2<T, TResult>, times: Times): void; | ||
verifyAll(): void; | ||
} | ||
} | ||
declare namespace TypeMoqIntern { | ||
class Times { | ||
private _condition; | ||
private _from; | ||
private _to; | ||
private static NO_MATCHING_CALLS_EXACTLY_N_TIMES; | ||
private static NO_MATCHING_CALLS_AT_LEAST_ONCE; | ||
private static NO_MATCHING_CALLS_AT_MOST_ONCE; | ||
private _lastCallCount; | ||
private _failMessage; | ||
constructor(_condition: IFunc2<number, boolean>, _from: number, _to: number, failMessage: string); | ||
failMessage: any; | ||
verify(callCount: number): boolean; | ||
static exactly(n: number): Times; | ||
static never(): Times; | ||
static once(): Times; | ||
static atLeastOnce(): Times; | ||
static atMostOnce(): Times; | ||
} | ||
} | ||
import api = TypeMoqIntern.Api; | ||
import error = TypeMoqIntern.Error; | ||
import match = TypeMoqIntern.Match; | ||
import proxy = TypeMoqIntern.Proxy; | ||
declare namespace TypeMoqIntern { | ||
class GlobalScope implements api.IUsingResult { | ||
private _args; | ||
constructor(_args: IGlobalMock<any>[]); | ||
static using(...args: IGlobalMock<any>[]): api.IUsingResult; | ||
with(action: IAction): void; | ||
} | ||
} | ||
interface ITypeMoq { | ||
Mock: typeof TypeMoqIntern.Mock; | ||
MockBehavior: typeof TypeMoqIntern.MockBehavior; | ||
It: typeof TypeMoqIntern.It; | ||
Times: typeof TypeMoqIntern.Times; | ||
GlobalMock: typeof TypeMoqIntern.GlobalMock; | ||
GlobalScope: typeof TypeMoqIntern.GlobalScope; | ||
MockException: typeof TypeMoqIntern.Error.MockException; | ||
} | ||
declare module TypeMoq { | ||
export import Mock = TypeMoqIntern.Mock; | ||
export import MockBehavior = TypeMoqIntern.MockBehavior; | ||
export import It = TypeMoqIntern.It; | ||
export import Times = TypeMoqIntern.Times; | ||
export import GlobalMock = TypeMoqIntern.GlobalMock; | ||
export import GlobalScope = TypeMoqIntern.GlobalScope; | ||
export import MockException = TypeMoqIntern.Error.MockException; | ||
} | ||
declare var typemoq: ITypeMoq; | ||
//# sourceMappingURL=output.d.ts.map | ||
export = TypeMoq; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251603
2678
464