public void FailInUpdateNotExistLodgingTest() { var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict); lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Throws(new ClientException()); lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>())); LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object); Lodging resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging); }
public void FailInUpdateLodgingWithAnyErrorFieldTest() { lodging.Address = ""; var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict); lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(lodging); lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>())); LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object); Lodging resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging); }
public void UpdateValidLodgingTest() { lodging.Name = "San Ramon Hotel"; var lodgingRepositoryMock = new Mock <ILodgingRepository>(MockBehavior.Strict); lodgingRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(lodging); lodgingRepositoryMock.Setup(m => m.Update(It.IsAny <Lodging>())); LodgingManagement lodgingLogic = new LodgingManagement(lodgingRepositoryMock.Object); Lodging resultOfUpdate = lodgingLogic.UpdateLodging(lodging.Id, lodging); lodgingRepositoryMock.VerifyAll(); Assert.IsTrue(resultOfUpdate.Name.Equals("San Ramon Hotel")); }