public async Task ShouldRetrieveTeacherAttachmentByIdAsync()
        {
            // given
            TeacherAttachment randomTeacherAttachment   = CreateRandomTeacherAttachment();
            TeacherAttachment storageTeacherAttachment  = randomTeacherAttachment;
            TeacherAttachment expectedTeacherAttachment = storageTeacherAttachment;

            this.storageBrokerMock.Setup(broker =>
                                         broker.SelectTeacherAttachmentByIdAsync
                                             (randomTeacherAttachment.TeacherId, randomTeacherAttachment.AttachmentId))
            .ReturnsAsync(storageTeacherAttachment);

            // when
            TeacherAttachment actualTeacherAttachment = await
                                                        this.teacherAttachmentService.RetrieveTeacherAttachmentByIdAsync(
                randomTeacherAttachment.TeacherId, randomTeacherAttachment.AttachmentId);

            // then
            actualTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);

            this.storageBrokerMock.Verify(broker =>
                                          broker.SelectTeacherAttachmentByIdAsync
                                              (randomTeacherAttachment.TeacherId, randomTeacherAttachment.AttachmentId),
                                          Times.Once);

            this.storageBrokerMock.VerifyNoOtherCalls();
            this.loggingBrokerMock.VerifyNoOtherCalls();
            this.dateTimeBrokerMock.VerifyNoOtherCalls();
        }
        public async Task ShouldAddTeacherAttachmentAsync()
        {
            // given
            TeacherAttachment randomTeacherAttachment   = CreateRandomTeacherAttachment();
            TeacherAttachment inputTeacherAttachment    = randomTeacherAttachment;
            TeacherAttachment storageTeacherAttachment  = randomTeacherAttachment;
            TeacherAttachment expectedTeacherAttachment = storageTeacherAttachment;

            this.storageBrokerMock.Setup(broker =>
                                         broker.InsertTeacherAttachmentAsync(inputTeacherAttachment))
            .ReturnsAsync(storageTeacherAttachment);

            // when
            TeacherAttachment actualTeacherAttachment =
                await this.teacherAttachmentService.AddTeacherAttachmentAsync(inputTeacherAttachment);

            // then
            actualTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);

            this.storageBrokerMock.Verify(broker =>
                                          broker.InsertTeacherAttachmentAsync(inputTeacherAttachment),
                                          Times.Once);

            this.storageBrokerMock.VerifyNoOtherCalls();
            this.loggingBrokerMock.VerifyNoOtherCalls();
            this.dateTimeBrokerMock.VerifyNoOtherCalls();
        }
        public async Task ShouldGetAllTeacherAttachmentsAsync()
        {
            // given
            var randomTeacherAttachments = new List <TeacherAttachment>();

            for (var i = 0; i <= GetRandomNumber(); i++)
            {
                TeacherAttachment randomTeacherAttachment = await PostTeacherAttachmentAsync();

                randomTeacherAttachments.Add(randomTeacherAttachment);
            }

            List <TeacherAttachment> inputTeacherAttachments    = randomTeacherAttachments;
            List <TeacherAttachment> expectedTeacherAttachments = inputTeacherAttachments;

            // when
            List <TeacherAttachment> actualTeacherAttachments =
                await this.otripleSApiBroker.GetAllTeacherAttachmentsAsync();

            // then
            foreach (TeacherAttachment expectedTeacherAttachment in expectedTeacherAttachments)
            {
                TeacherAttachment actualTeacherAttachment =
                    actualTeacherAttachments.Single(studentAttachment =>
                                                    studentAttachment.TeacherId == expectedTeacherAttachment.TeacherId);

                actualTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);

                await DeleteTeacherAttachmentAsync(actualTeacherAttachment);
            }
        }
        public async Task ShouldPostTeacherAttachmentAsync()
        {
            // given
            TeacherAttachment randomTeacherAttachment = await CreateRandomTeacherAttachment();

            TeacherAttachment inputTeacherAttachment    = randomTeacherAttachment;
            TeacherAttachment expectedTeacherAttachment = inputTeacherAttachment;

            // when
            TeacherAttachment actualTeacherAttachment =
                await this.otripleSApiBroker.PostTeacherAttachmentAsync(inputTeacherAttachment);

            TeacherAttachment retrievedTeacherAttachment =
                await this.otripleSApiBroker.GetTeacherAttachmentByIdsAsync(
                    inputTeacherAttachment.TeacherId,
                    inputTeacherAttachment.AttachmentId);

            // then
            actualTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);
            retrievedTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);
            await DeleteTeacherAttachmentAsync(actualTeacherAttachment);
        }
        public async Task ShouldDeleteTeacherAttachmentAsync()
        {
            // given
            TeacherAttachment randomTeacherAttachment = await PostTeacherAttachmentAsync();

            TeacherAttachment inputTeacherAttachment    = randomTeacherAttachment;
            TeacherAttachment expectedTeacherAttachment = inputTeacherAttachment;

            // when
            TeacherAttachment deletedTeacherAttachment =
                await DeleteTeacherAttachmentAsync(inputTeacherAttachment);

            ValueTask <TeacherAttachment> getTeacherAttachmentByIdTask =
                this.otripleSApiBroker.GetTeacherAttachmentByIdsAsync(
                    inputTeacherAttachment.TeacherId,
                    inputTeacherAttachment.AttachmentId);

            // then
            deletedTeacherAttachment.Should().BeEquivalentTo(expectedTeacherAttachment);

            await Assert.ThrowsAsync <HttpResponseNotFoundException>(() =>
                                                                     getTeacherAttachmentByIdTask.AsTask());
        }