How to use typemoq - 10 common examples

To help you get started, we’ve selected a few typemoq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tierratelematics / prettygoat / test / cassandra / CassandraStreamFactorySpec.ts View on Github external
import "reflect-metadata";
import expect = require("expect.js");
import {Mock, IMock, Times, It} from "typemoq";
import CassandraStreamFactory from "../../scripts/cassandra/CassandraStreamFactory";
import TimePartitioner from "../../scripts/cassandra/TimePartitioner";
import {ICassandraClient, IQuery} from "../../scripts/cassandra/ICassandraClient";
import * as Rx from "rx";
import {Event} from "../../scripts/streams/Event";
import IDateRetriever from "../../scripts/util/IDateRetriever";
import IEventsFilter from "../../scripts/cassandra/IEventsFilter";
import IEventDeserializer from "../../scripts/streams/IEventDeserializer";
const anyValue = It.isAny();

describe("Cassandra stream factory, given a stream factory", () => {

    let client: IMock;
    let subject: CassandraStreamFactory;
    let timePartitioner: IMock;
    let events: Event[];
    let dateRetriever: IMock;
    let endDate = new Date(600);

    beforeEach(() => {
        events = [];
        dateRetriever = Mock.ofType();
        let eventsFilter = Mock.ofType();
        timePartitioner = Mock.ofType(TimePartitioner);
        let deserializer = Mock.ofType();
github tierratelematics / prettygoat / test / ProjectionFactorySpec.ts View on Github external
        objectContainer.setup(o => o.resolve(It.isAny())).returns(() => new MockProjectionDefinition());
github tierratelematics / ninjagoat / test / ContextFactorySpec.ts View on Github external
            viewResolver.setup(v => v.resolve(It.isAny(), It.isAny())).returns(() => BarView);
            uriResolver.setup(u => u.resolve(It.isAny())).returns(() => {
github Squidex / squidex / src / Squidex / app / shared / guards / unset-app.guard.spec.ts View on Github external
it('should unselect app', () => {
        appsState.setup(x => x.select(null))
            .returns(() => of(null));

        let result = false;

        appGuard.canActivate().subscribe(value => {
            result = value;
        });

        expect(result).toBeTruthy();

        appsState.verify(x => x.select(null), Times.once());
    });
});
github Squidex / squidex / frontend / app / shared / guards / unset-content.guard.spec.ts View on Github external
it('should unset content', () => {
        contentsState.setup(x => x.select(null))
            .returns(() => of(null));

        let result: boolean;

        contentGuard.canActivate().subscribe(x => {
            result = x;
        }).unsubscribe();

        expect(result!).toBeTruthy();

        contentsState.verify(x => x.select(null), Times.once());
    });
});
github Squidex / squidex / src / Squidex / app / shared / state / contributors.state.spec.ts View on Github external
it('should show notification on load when reload is true', () => {
            contributorsState.load(true).subscribe();

            expect().nothing();

            dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once());
        });
    });
github Squidex / squidex / src / Squidex / app / features / administration / guards / unset-user.guard.spec.ts View on Github external
it('should unset user', () => {
        usersState.setup(x => x.select(null))
            .returns(() => of(null));

        let result: boolean;

        userGuard.canActivate().subscribe(x => {
            result = x;
        }).unsubscribe();

        expect(result!).toBeTruthy();

        usersState.verify(x => x.select(null), Times.once());
    });
});
github Squidex / squidex / frontend / app / shared / guards / load-languages.guard.spec.ts View on Github external
it('should load languages', () => {
        languagesState.setup(x => x.load())
            .returns(() => of(null));

        let result = false;

        languageGuard.canActivate().subscribe(value => {
            result = value;
        });

        expect(result).toBeTruthy();

        languagesState.verify(x => x.load(), Times.once());
    });
});
github node-ts / bus / packages / bus-core / src / application-bootstrap / application-bootstrap.spec.ts View on Github external
h => h.register(
          TestCommand.NAME,
          It.isAny(),
          TestCommandHandler,
          TestCommand
        ),
        Times.once()

typemoq

A simple mocking library for TypeScript

MIT
Latest version published 6 years ago

Package Health Score

50 / 100
Full package analysis