public void FailAboutGetAllLodgingsExceptionClientTest() { List <Lodging> lodgingsToReturn = new List <Lodging>() { lodging }; var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict); lodgingRepositoryMock.Setup(m => m.GetAll()).Throws(new ClientException()); LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object); List <Lodging> loadgingsObteinedOfGetAll = lodgingLogic.GetAllLoadings(); }
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); }
public void GetAllLodgingsTestOk() { List <Lodging> lodgingsToReturn = new List <Lodging>() { lodging }; var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict); lodgingRepositoryMock.Setup(m => m.GetAll()).Returns(lodgingsToReturn); LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object); List <Lodging> lodgingsObteinedOfGetAll = lodgingLogic.GetAllLoadings(); lodgingRepositoryMock.VerifyAll(); CollectionAssert.AreEqual(lodgingsToReturn, lodgingsObteinedOfGetAll); }