Beispiel #1
0
    public async Task archive_scheduled_day()
    {
        var expected = new DayScheduleArchived(_dayId.Value);

        Given(new DayScheduled(_dayId.Value, _doctorId.Value, _date));
        await When(new ArchiveDaySchedule(_dayId.Value));

        Then(e =>
        {
            Assert.IsType <DayScheduleArchived>(e.First());
            Assert.Equal(expected, e.First());
        });
    }
    public async Task should_archive_all_events_and_truncate_all_except_last_one()
    {
        var dayId       = Guid.NewGuid().ToString();
        var scheduled   = new SlotScheduled(Guid.NewGuid(), dayId, _now, _tenMinutes);
        var slotBooked  = new SlotBooked(dayId, scheduled.SlotId, "PatientId");
        var dayArchived = new DayScheduleArchived(dayId);

        var metadata = new CommandMetadata(new CorrelationId(Guid.NewGuid()), new CausationId(Guid.NewGuid()));

        var events = new List <object> {
            scheduled, slotBooked, dayArchived
        };

        await _esStore.AppendEvents("Day-" + dayId, metadata, events.ToArray());

        await Given(dayArchived);

        Then(events, _inMemoryColdStorage.Events);
        Then(new List <object> {
            dayArchived
        }, await _esStore.LoadEvents("Day-" + dayId));
    }
Beispiel #3
0
 private void When(DayScheduleArchived @event) =>
 _isArchived = true;