コード例 #1
0
ファイル: SagaTests.cs プロジェクト: seankearon/rebus-demo
        public void A_Welcome_Pack_Is_Sent_To_The_Customer_After_Their_Account_Has_Been_Created()
        {
            var customerName = RandomName;
            var bus          = new FakeBus();

            using (var fixture = SagaFixture.For(() => new OnboardCustomerSaga(bus)))
            {
                fixture.Deliver(new OnboardCustomer {
                    CustomerName = customerName
                });
                fixture.Deliver(new CustomerAccountCreated {
                    CustomerName = customerName
                });

                fixture.SagaDataShould(
                    have: x => x.AccountCreated,
                    because: "it should remember the account has been created")
                .SagaDataIsNotComplete();
                bus.HasSent <SendWelcomePackToCustomer>(
                    with: x => x.CustomerName == customerName,
                    because: "it should initiate welcome pack creation"
                    );

                fixture.ShouldNotHaveCompleted();
            }
        }