示例#1
0
    public async Task cancel_booked_slots_when_the_day_is_cancelled()
    {
        var slotOneId = new SlotId(Guid.NewGuid());
        var slotTwoId = new SlotId(Guid.NewGuid());

        var slotCancelledExpected            = new SlotBookingCancelled(_dayId.Value, slotOneId.Value, null);
        var slotOneScheduleCancelledExpected = new SlotScheduleCancelled(_dayId.Value, slotOneId.Value);
        var slotTwoScheduleCancelledExpected = new SlotScheduleCancelled(_dayId.Value, slotTwoId.Value);
        var dayCancelledExpected             = new DayScheduleCancelled(_dayId.Value);

        Given(
            new DayScheduled(_dayId.Value, _doctorId.Value, _date),
            new SlotScheduled(slotOneId.Value, _dayId.Value, _date, TimeSpan.FromMinutes(10)),
            new SlotScheduled(slotTwoId.Value, _dayId.Value, _date, TimeSpan.FromMinutes(10)),
            new SlotBooked(_dayId.Value, slotOneId.Value, "John Doe"));

        await When(new CancelDaySchedule(_dayId.Value));

        Then(e =>
        {
            Assert.IsType <SlotBookingCancelled>(e[0]);
            Assert.Equal(slotCancelledExpected, e[0]);

            Assert.IsType <SlotScheduleCancelled>(e[1]);
            Assert.Equal(slotOneScheduleCancelledExpected, e[1]);

            Assert.IsType <SlotScheduleCancelled>(e[2]);
            Assert.Equal(slotTwoScheduleCancelledExpected, e[2]);

            Assert.IsType <DayScheduleCancelled>(e[3]);
            Assert.Equal(dayCancelledExpected, e[3]);
        });
    }
示例#2
0
 private void When(DayScheduleCancelled obj)
 {
     _isCancelled = true;
 }