public async void GetIschildfriendlyTest(bool inlineBool, int expected) { IList <AttractionModel> attractions = GenerateAttractions(); var TravelAPIContextMock = new Mock <TravelAPIContext>(); TravelAPIContextMock.Setup(e => e.Attractions).ReturnsDbSet(attractions); var logger = Mock.Of <ILogger <AttractionRepo> >(); var attractionRepo = new AttractionRepo(TravelAPIContextMock.Object, logger); //Act var theAttractions = await attractionRepo.GetIschildfriendly(inlineBool); //Assert Assert.Equal(expected, theAttractions.Count); }
public async void GetRatingTest(int inlineNum, int expected) { //Arrange IList <AttractionModel> attractions = GenerateAttractions(); var TravelAPIContextMock = new Mock <TravelAPIContext>(); TravelAPIContextMock.Setup(e => e.Attractions).ReturnsDbSet(attractions); var logger = Mock.Of <ILogger <AttractionRepo> >(); var attractionRepo = new AttractionRepo(TravelAPIContextMock.Object, logger); //Act var theAttractions = await attractionRepo.GetRating(inlineNum); //Assert Assert.Equal(expected, theAttractions.Count); }
public async void GetAttractionTest() { IList <AttractionModel> attractions = GenerateAttractions(); var TravelAPIContextMock = new Mock <TravelAPIContext>(); TravelAPIContextMock.Setup(e => e.Attractions).ReturnsDbSet(attractions); var logger = Mock.Of <ILogger <AttractionRepo> >(); var attractionRepo = new AttractionRepo(TravelAPIContextMock.Object, logger); //Act string attraction = "The Fun Thing"; var theAttraction = await attractionRepo.GetAttraction(attraction); //Assert Assert.Equal(1, theAttraction.AttractionId); }