Exemplo n.º 1
0
        public async Task a_passing_aggregate_with_events_raised_in_the_constructor_should()
        {
            var result = await Scenario.ForAggregate <ConstructorBehaviorAggregate>()
                         .When(() => new ConstructorBehaviorAggregate(Guid.Empty))
                         .Then(new SomethingHappened());

            result.Passed.Should().BeTrue();
        }
Exemplo n.º 2
0
        public async Task a_passing_aggregate_scenario_with_no_given_should()
        {
            var result = await Scenario.ForAggregate(id => new Aggregate(id))
                         .When(a => a.DoSomething())
                         .Then(new SomethingHappened());

            result.Passed.Should().BeTrue();
        }
Exemplo n.º 3
0
        public async Task an_aggregate_throwing_an_expected_exception_should()
        {
            var result = await Scenario.ForAggregate(id => new BuggyAggregate(id))
                         .When(a => a.DoSomething())
                         .ThenShouldThrow <InvalidOperationException>();

            result.Passed.Should().BeTrue();
            result.Results.Should().BeOfType <InvalidOperationException>();
        }
Exemplo n.º 4
0
        public async Task an_aggregate_throwing_an_exception_in_its_constructor_should()
        {
            var result = await Scenario.ForAggregate(id => new ReallyBuggyAggregate(id))
                         .When(a => a.DoSomething())
                         .Then(new SomethingHappened());

            result.Passed.Should().BeFalse();
            result.Results.Should().BeOfType <ScenarioException>();
        }