コード例 #1
0
        public void CanChangeAddress()
        {
            IBus bus = new TestBus();
            IHasPostalAddress customer = new Customer(bus);

            customer.RequestChangeAddress(new ChangeAddressRequested());
            Assert.True(bus.HasMessage(m => m is AddressChanged));
        }
コード例 #2
0
        public void WhenAddressHold_IsActive_AndIsMadeInactive_CanChangeAddress()
        {
            IBus bus = new TestBus();
            IHasPostalAddress customer = new Customer(bus);

            customer.RequestAddressHold(new AddressHoldRequested());
            customer.RequestReleaseAddressHold(new ReleaseAddressHoldRequested());
            customer.RequestChangeAddress(new ChangeAddressRequested());
            Assert.True(bus.HasMessage(m => m is AddressChanged));
        }
コード例 #3
0
        public void WhenAddressHoldIsActive_CannotChangeAddress()
        {
            IBus bus = new TestBus();
            IHasPostalAddress customer = new Customer(bus);

            customer.RequestAddressHold(new AddressHoldRequested());
            customer.RequestChangeAddress(new ChangeAddressRequested());
            Assert.False(bus.HasMessage(m => m is AddressChanged));
            Assert.True(bus.HasMessage(m => m is BusinessLogicError <ChangeAddressRequested>));
        }