public void FailAboutGetAllTouristSpotClientExceptionTest() { List <TouristSpot> touristSpotToReturn = new List <TouristSpot>() { touristSpot1, touristSpot2, touristSpot3 }; var touristSpotRepositoryMock = new Mock <ITouristSpotRepository>(MockBehavior.Strict); touristSpotRepositoryMock.Setup(m => m.GetAll()).Throws(new ClientException()); var touristSpotLogic = new TouristSpotManagement(touristSpotRepositoryMock.Object); List <TouristSpot> touristSpotObteinedOfGetAll = touristSpotLogic.GetAllTouristSpot(); }
public void RemoveValidTouristSpot() { var touristSpotRepositoryMock = new Mock <ITouristSpotRepository>(MockBehavior.Strict); touristSpotRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(touristSpot1); touristSpotRepositoryMock.Setup(m => m.Remove(It.IsAny <TouristSpot>())); touristSpotRepositoryMock.Setup(m => m.GetAll()).Returns(new List <TouristSpot>()); var touristSpotLogic = new TouristSpotManagement(touristSpotRepositoryMock.Object); touristSpotLogic.RemoveTouristSpot(touristSpot1.Id); List <TouristSpot> listOfTouristSpot = touristSpotLogic.GetAllTouristSpot(); touristSpotRepositoryMock.VerifyAll(); Assert.IsTrue(listOfTouristSpot.Count == 0); }
public void GetAllTouristSpot() { List <TouristSpot> touristSpotToReturn = new List <TouristSpot>() { touristSpot1, touristSpot2, touristSpot3 }; var touristSpotRepositoryMock = new Mock <ITouristSpotRepository>(MockBehavior.Strict); touristSpotRepositoryMock.Setup(m => m.GetAll()).Returns(touristSpotToReturn); var touristSpotLogic = new TouristSpotManagement(touristSpotRepositoryMock.Object); List <TouristSpot> touristSpotObteinedOfGetAll = touristSpotLogic.GetAllTouristSpot(); touristSpotRepositoryMock.VerifyAll(); CollectionAssert.AreEqual(touristSpotToReturn, touristSpotObteinedOfGetAll); }