Ejemplo n.º 1
0
    public async Task ConstructorWithMessageSinkHasHigherPriorityThanParameterlessConstructor()
    {
        var runner = TestableAspNetTestAssemblyRunner.Create(typeof(TestAssemblyFixtureWithMessageSink));

        await runner.AfterTestAssemblyStartingAsync_Public();

        Assert.NotNull(runner.Fixtures);
        var fixtureObject = Assert.Single(runner.Fixtures);
        var fixture       = Assert.IsType <TestAssemblyFixtureWithMessageSink>(fixtureObject);

        Assert.True(fixture.ConstructorWithMessageSinkCalled);
        Assert.False(fixture.ParameterlessConstructorCalled);
    }
Ejemplo n.º 2
0
    public async Task CalledInExpectedOrder_SuccessWithDispose()
    {
        var runner = TestableAspNetTestAssemblyRunner.Create(typeof(TextAssemblyFixtureWithDispose));

        var runSummary = await runner.RunAsync();

        Assert.NotNull(runSummary);
        Assert.Equal(0, runSummary.Failed);
        Assert.Equal(0, runSummary.Skipped);
        Assert.Equal(1, runSummary.Total);

        Assert.NotNull(runner.Fixtures);
        var fixtureObject = Assert.Single(runner.Fixtures);
        var fixture       = Assert.IsType <TextAssemblyFixtureWithDispose>(fixtureObject);

        Assert.Equal(NotCalled, fixture.ReportTestFailureCalledAt);
        Assert.Equal(0, fixture.DisposeCalledAt);
    }
Ejemplo n.º 3
0
    public async Task CalledInExpectedOrder_FailedWithAsyncDispose()
    {
        var runner = TestableAspNetTestAssemblyRunner.Create(
            typeof(TestAssemblyFixtureWithAsyncDispose),
            failTestCase: true);

        var runSummary = await runner.RunAsync();

        Assert.NotNull(runSummary);
        Assert.Equal(1, runSummary.Failed);
        Assert.Equal(0, runSummary.Skipped);
        Assert.Equal(1, runSummary.Total);

        Assert.NotNull(runner.Fixtures);
        var fixtureObject = Assert.Single(runner.Fixtures);
        var fixture       = Assert.IsType <TestAssemblyFixtureWithAsyncDispose>(fixtureObject);

        Assert.Equal(0, fixture.InitializeAsyncCalledAt);
        Assert.Equal(1, fixture.ReportTestFailureCalledAt);
        Assert.Equal(2, fixture.AsyncDisposeCalledAt);
    }