public async Task AddNewWorkerToShopSchedule() { var newWorkerId = Guid.NewGuid(); var newRecord = CreateRecord(new TimePeriod(TimeSpan.FromHours(4), TimeSpan.FromHours(6))); await workerScheduleRepository.WriteAsync(shopId, WorkerCalendarDayBuilder <T> .Create(newWorkerId, currentDate) .AddRecord(newRecord) .Build()); var shopSchedule = await workerScheduleRepository.ReadShopCalendarDayAsync(shopId, currentDate); shopSchedule.Should().BeEquivalentTo(ShopCalendarDayBuilder <T> .Create(shopId, currentDate) .AddWorkerDay(workerId, builder => builder.AddRecord(defaultRecord)) .AddWorkerDay(newWorkerId, builder => builder.AddRecord(newRecord)) .Build()); var workerSchedule = await workerScheduleRepository.ReadWorkerCalendarDayAsync(shopId, currentDate, newWorkerId); workerSchedule.Should().BeEquivalentTo(WorkerCalendarDayBuilder <T> .Create(newWorkerId, currentDate) .AddRecord(newRecord) .Build()); }
public async Task UpdateEmptyScheduleTest() { var shopCalendarMonth = await workerScheduleRepository.ReadShopCalendarMonthAsync(shopId, currentDate); shopCalendarMonth.Should().BeEquivalentTo(ShopCalendarMonthBuilder <T> .Create(shopId, currentDate) .AddShopDay(currentDate, shopBuilder => shopBuilder.AddWorkerDay(workerId, workerBuilder => workerBuilder.AddRecord(defaultRecord))) .Build()); var shopCalendarDay = await workerScheduleRepository.ReadShopCalendarDayAsync(shopId, currentDate); shopCalendarDay.Should().BeEquivalentTo(ShopCalendarDayBuilder <T> .Create(shopId, currentDate) .AddWorkerDay(workerId, builder => builder.AddRecord(defaultRecord)) .Build()); var workerSchedule = await workerScheduleRepository.ReadWorkerCalendarDayAsync(shopId, currentDate, workerId); workerSchedule.Should().BeEquivalentTo(WorkerCalendarDayBuilder <T> .Create(workerId, currentDate) .AddRecord(defaultRecord) .Build()); }