Пример #1
0
 public void Cleanup()
 {
     this.classroom1           = null;
     this.classroom2           = null;
     this.classroomCreatingDto = null;
     this.classroomDetailsDto1 = null;
 }
 public void Cleanup()
 {
     this._classroom            = null;
     this._classroomCreatingDto = null;
     this._classroomDetailsDto  = null;
     this._classroomMapper      = null;
 }
 public void Setup()
 {
     this._classroom            = ClassroomTestUtils.GetClassroom();
     this._classroomCreatingDto = ClassroomTestUtils.GetClassroomCreatingDto();
     this._classroomDetailsDto  = ClassroomTestUtils.GetClassroomDetailsDto(_classroom.Id);
     this._classroomMapper      = new ClassroomMapper();
 }
Пример #4
0
 public void Setup()
 {
     this.client               = new CustomWebApplicationFactory <Startup>().CreateClient();
     this.classroom1           = ClassroomTestUtils.GetClassroom();
     this.classroom2           = ClassroomTestUtils.GetClassroom2();
     this.classroomCreatingDto = ClassroomTestUtils.GetClassroomCreatingDto();
     this.classroomDetailsDto1 = ClassroomTestUtils.GetClassroomDetailsDto(classroom1.Id);
 }
Пример #5
0
 public void Cleanup()
 {
     this._classroom1           = null;
     this._classroom2           = null;
     this._classroomCreatingDto = null;
     this._classroomDetailsDto1 = null;
     this._classroomDetailsDto2 = null;
     this._mockReadRepository   = null;
     this._mockWriteRepository  = null;
     this._mockClassroomMapper  = null;
     this._classroomService     = null;
 }
Пример #6
0
 public void Setup()
 {
     this._classroom1           = ClassroomTestUtils.GetClassroom();
     this._classroom2           = ClassroomTestUtils.GetClassroom2();
     this._classroomCreatingDto = ClassroomTestUtils.GetClassroomCreatingDto();
     this._classroomDetailsDto1 = ClassroomTestUtils.GetClassroomDetailsDto(_classroom1.Id);
     this._classroomDetailsDto2 = ClassroomTestUtils.GetClassroomDetailsDto(_classroom2.Id);
     this._mockReadRepository   = new Mock <IReadRepository>();
     this._mockWriteRepository  = new Mock <IWriteRepository>();
     this._mockClassroomMapper  = new Mock <IClassroomMapper>();
     this._classroomService     = new ClassroomService(_mockWriteRepository.Object, _mockReadRepository.Object, _mockClassroomMapper.Object);
 }
Пример #7
0
        public async Task <IActionResult> Create([FromBody] ClassroomCreatingDto classroomCreatingDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                var classroom = await this.classroomService.Create(classroomCreatingDto);

                return(CreatedAtRoute("FindClassroomById", new { classroomId = classroom.Id }, classroom));
            }
            catch (ClassroomLocationAlreadyExistsException exception)
            {
                return(BadRequest(exception.Message));
            }
        }
 public Domain.Entities.Classroom Map(ClassroomCreatingDto classroomCreatingDto)
 {
     return(new Domain.Entities.Classroom(classroomCreatingDto.Location, classroomCreatingDto.Capacity));
 }