public async Task SetLodgmentActiveStatusAsync_LodgmentExists_ShouldReturnTheLodgmentActive()
        {
            // Arrange
            var isActive = true;

            expectedLodgment.IsActive = false;
            expectedLodgment.Id       = lodgmentId;
            context.Add(expectedLodgment);
            context.SaveChanges();

            //Act
            var actualLodgment = await repository.SetLodgmentActiveStatusAsync(lodgmentId, isActive);

            //Assert
            Assert.AreEqual(expectedLodgment.Id, actualLodgment.Id);
            Assert.AreEqual(expectedLodgment.IsActive, actualLodgment.IsActive);
        }
Beispiel #2
0
        public async Task <Lodgment> SetLodgmentActiveStatusAsync(int id, bool isActive)
        {
            var lodgment = await repository.GetLodgmentByIdAsync(id);

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

            lodgment = await repository.SetLodgmentActiveStatusAsync(id, isActive);

            return(lodgment);
        }