public async Task DeleteLodgmentAsync_LodgmentExists_ShouldReturnTheLodgment()
        {
            // Arrange
            expectedLodgment.Id = lodgmentId;
            context.Add(expectedLodgment);
            context.SaveChanges();

            //Act
            var actualLodgment = await repository.DeleteLodgmentAsync(lodgmentId);

            //Assert
            Assert.AreEqual(expectedLodgment, actualLodgment);
        }
Exemplo n.º 2
0
        public async Task <Lodgment> DeleteLodgmentAsync(int id)
        {
            var lodgment = await repository.GetLodgmentByIdAsync(id);

            if (lodgment == null)
            {
                throw new KeyNotFoundException("El hospedaje no existe.");
            }

            lodgment = await repository.DeleteLodgmentAsync(id);

            return(lodgment);
        }