Example #1
0
        public void If_The_Ola_Is_Breached_Then_Other_Systems_Will_Not_Be_Notified_About_The_Onboarding()
        {
            var customerName = RandomName;
            var bus          = new FakeBus();

            using (var fixture = SagaFixture.For(() => new OnboardCustomerSaga(bus)))
            {
                fixture.Deliver(new OnboardCustomer {
                    CustomerName = customerName
                });
                bus.HasDeferredLocal <VerifyCustomerOnboardingOla>(
                    with: x => x.CustomerName == customerName,
                    because: "it should start tracking the OLA");

                fixture.Deliver(new VerifyCustomerOnboardingOla {
                    CustomerName = customerName
                });

                fixture.ShouldHaveCompleted();
                bus.HasNotPublished <CustomerOnboarded>(because: "the saga was not successful and there should be no event notifying of a customer onboarding");
            }
        }