public async Task ShouldCreateClassroomFromLocation() { var createLocationDto = await SendAsync(new CreateLocationItemCommand { Name = "location1", IsEnabled = true, OpeningTime = new TimeSpan(0, 19, 0), ClosingTime = new TimeSpan(0, 21, 0), }); CreateClassroomFromLocationCommand command = new CreateClassroomFromLocationCommand { IsEnabled = true, Name = "Classroom1", Capacity = 40, LocationId = createLocationDto.Id }; CreateClassroomFromLocationDto dto = await SendWithValidationAsync(command, new CreateClassroomFromLocationCommandValidator()); var created = await ExecuteDbContextAsync(db => db.Classrooms.Where(c => c.Id.Equals(dto.Id)).SingleOrDefaultAsync()); created.ShouldNotBeNull(); created.LocationId.ShouldBe(createLocationDto.Id); created.Capacity.ShouldBe(command.Capacity); created.Name.ShouldBe(command.Name); created.IsEnabled.ShouldBe(command.IsEnabled); }
private async Task <CreateDailyScheduleItemDto> CreateDailyScheduleAsync(CreateClassroomFromLocationDto classroomDto) { var scheduleDate = DateTime.UtcNow.Date; var command = new CreateDailyScheduleItemCommand() { DayOfWeek = DayOfWeek.Monday, Disabled = false, WeekNumber = 3, DateSchedule = scheduleDate, ClassroomId = classroomDto.Id, }; var dto = await SendAsync(command); return(dto); }