public async Task GetByID_TryToGetNonExistentEntity_ReturnsNull()
        {
            const int entityToGetID = 7;

            FakeDTO actualDTO = await _testRepository.GetByID(entityToGetID);

            Assert.AreEqual(null, actualDTO);
        }
        public async Task Update_TryToUpdateDeletedEntity_ThrowsException()
        {
            const int entityToUpdateID = 3;

            FakeDTO dto = _mapper.Map <FakeDTO>(await _context.FindAsync <FakeEntity>(entityToUpdateID));

            Assert.ThrowsAsync <DbUpdateException>(async() => await _testRepository.Update(entityToUpdateID, dto));
        }
        public async Task Update_TryToUpdateNonExistentEntity_ThrowsException()
        {
            const int entityToUseID    = 1;
            const int entityToUpdateID = 7;

            FakeDTO dto = _mapper.Map <FakeDTO>(await _context.FindAsync <FakeEntity>(entityToUseID));

            Assert.ThrowsAsync <ArgumentException>(async() => await _testRepository.Update(entityToUpdateID, dto));
        }
        public async Task GetByID_GetsEntityFromDatabaseAndConvertsToDTO_Succeeds()
        {
            const int entityToGetID = 1;

            FakeDTO expectedDTO = new FakeDTO()
            {
                ID = entityToGetID, Text = "Text for entity 1."
            };

            string expectedSerializedDTO = JsonConvert.SerializeObject(expectedDTO);

            FakeDTO actualDTO = await _testRepository.GetByID(entityToGetID);

            string actualSerializedDTO = JsonConvert.SerializeObject(actualDTO);

            Assert.AreEqual(expectedSerializedDTO, actualSerializedDTO);
        }
        public async Task Create_CreatedEntityInDatabase_Succeeds()
        {
            const int expectedID = 7;

            FakeDTO expectedDTO = new FakeDTO()
            {
                ID = expectedID, Text = $"Text for entity {expectedID}."
            };

            await _testRepository.Create(expectedDTO);

            FakeEntity expectedEntity = _mapper.Map <FakeEntity>(expectedDTO);

            expectedEntity.IsActive = true;

            string expectedSerializedEntity = JsonConvert.SerializeObject(expectedEntity);

            FakeEntity actualEntity = await _context.FindAsync <FakeEntity>(expectedID);

            string actualSerializedEntity = JsonConvert.SerializeObject(actualEntity);

            Assert.AreEqual(expectedSerializedEntity, actualSerializedEntity);
        }