Esempio 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();
        }
Esempio 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();
        }
Esempio 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>();
        }
Esempio 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>();
        }