public async Task ShouldGetClassroomListFromLocation() { var locationDto = await SendAsync(new CreateLocationItemCommand() { IsEnabled = true, Name = "ShouldGetClassroomListFromLocation_location" }); var classroomDto = await SendAsync(new CreateClassroomFromLocationCommand() { IsEnabled = true, Name = "ShouldGetClassroomListFromLocation_classroom", Capacity = 40, LocationId = locationDto.Id }); var created = await ExecuteDbContextAsync(db => db.Classrooms.Where(c => c.Id.Equals(classroomDto.Id)).SingleOrDefaultAsync()); GetClassroomListFromLocationQuery query = new GetClassroomListFromLocationQuery() { LocationId = locationDto.Id }; GetObjectListVm <GetClassroomFromLocationDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetEnrollmentList() { var enrollmentDto = await CreateEnrollmentDtoAsync(); var created = await ExecuteDbContextAsync(db => db.Enrollments.Where(c => c.Id.Equals(enrollmentDto.Id)).SingleOrDefaultAsync()); GetEnrollmentListQuery query = new GetEnrollmentListQuery(); GetObjectListVm <GetEnrollmentItemDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetCourseList() { var command = new CreateCourseItemCommand() { Name = "Course1", Rate = 40, }; var createCourseItemDto = await SendAsync(command); var created = await ExecuteDbContextAsync(db => db.Courses.Where(c => c.Id.Equals(createCourseItemDto.Id)).SingleOrDefaultAsync()); GetCourseListQuery query = new GetCourseListQuery(); GetObjectListVm <GetCourseItemDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetInstructorList() { var instructorDto = await SendAsync(new CreateInstructorItemCommand() { FirstName = "first", LastName = "last", HireDate = DateTime.UtcNow.DateTimeWithoutMilisecond(), }); var created = await ExecuteDbContextAsync(db => db.Instructor.Where(c => c.Id.Equals(instructorDto.Id)).SingleOrDefaultAsync()); GetInstructorListQuery query = new GetInstructorListQuery(); GetObjectListVm <GetInstructorItemDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetLocationList() { var locationDto = await SendAsync(new CreateLocationItemCommand() { IsEnabled = true, Name = "ShouldGetLocationList", OpeningTime = new TimeSpan(0, 19, 0), ClosingTime = new TimeSpan(0, 21, 0), }); var created = await ExecuteDbContextAsync(db => db.Locations.Where(c => c.Id.Equals(locationDto.Id)).SingleOrDefaultAsync()); GetLocationListQuery query = new GetLocationListQuery(); GetObjectListVm <GetLocationDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetStudentList() { var createStudentItemCommand = new CreateStudentItemCommand() { FirstName = "first", LastName = "last" }; var createStudentDto = await SendAsync(createStudentItemCommand); var created = await ExecuteDbContextAsync(db => db.Students.Where(c => c.Id.Equals(createStudentDto.Id)).SingleOrDefaultAsync()); GetStudentListQuery query = new GetStudentListQuery(); GetObjectListVm <GetStudentItemDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }
public async Task ShouldGetCalendarSettingList() { var CalendarSettingDto = await SendAsync(new CreateCalendarSettingItemCommand() { FirstDayOfWeek = DayOfWeek.Monday, DefaultOpeningTime = new TimeSpan(19, 0, 0), DefaultClosingTime = new TimeSpan(21, 0, 0), AllowedTimeslotOverlap = false, }); var created = await ExecuteDbContextAsync(db => db.CalendarSettings.Where(c => c.Id.Equals(CalendarSettingDto.Id)).SingleOrDefaultAsync()); GetCalendarSettingListQuery query = new GetCalendarSettingListQuery(); GetObjectListVm <GetCalendarSettingItemDto> dto = await SendAsync(query); dto.ShouldNotBeNull(); dto.Count.ShouldBeGreaterThanOrEqualTo(1); dto.Data.ShouldContain(d => d.Id.Equals(created.Id)); }