Ejemplo n.º 1
0
        public void RemoveInvalidLodgingNotExistTest()
        {
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Throws(new ClientException());
            lodgingRepositoryMock.Setup(m => m.Remove(It.IsAny <Lodging>()));
            LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object);

            lodgingLogic.RemoveLodging(lodging.Id);
        }
Ejemplo n.º 2
0
        public void RemoveValidLodgingTest()
        {
            var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict);

            lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(lodging);
            lodgingRepositoryMock.Setup(m => m.Remove(It.IsAny <Lodging>()));
            lodgingRepositoryMock.Setup(m => m.GetAll()).Returns(new List <Lodging>());
            LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object);

            lodgingLogic.RemoveLodging(lodging.Id);
            List <Lodging> listOfLodging = lodgingLogic.GetAllLoadings();

            lodgingRepositoryMock.VerifyAll();
            Assert.IsTrue(listOfLodging.Count == 0);
        }