public void OnGetTest() { var validSearchRequest = new NearByAdventureLocationSearch { LatLon = "50,50" }; var resultList = new List<AdventureLocation> { new AdventureLocation(validSearchRequest.Point, "one"), new AdventureLocation(validSearchRequest.Point, "two") }; var expectedValidSearchResponse = new NearByAdventureLocationSearchResponse(validSearchRequest) {NearByAdventureLocations = resultList}; var mock = new Moq.Mock<IAdventureLocationSearchRepository>(); mock.Setup(a => a.GetNearByAdventureLocations(validSearchRequest.Point, validSearchRequest.Range)).Returns(resultList); var target = new NearByAdventureLocationSearchService {AdventureLocationSearchRepository = mock.Object}; var actual = target.OnGet(validSearchRequest) as NearByAdventureLocationSearchResponse; Assert.AreEqual(expectedValidSearchResponse, actual); Assert.AreNotEqual(new NearByAdventureLocationSearchResponse(validSearchRequest), actual); Assert.AreNotEqual(new NearByAdventureLocationSearchResponse(null), actual); Assert.AreNotEqual(new NearByAdventureLocationSearchResponse(new NearByAdventureLocationSearch()), actual); Assert.AreEqual(new NearByAdventureLocationSearchResponse(new NearByAdventureLocationSearch()), new NearByAdventureLocationSearchResponse(new NearByAdventureLocationSearch())); }
public bool Equals(NearByAdventureLocationSearchResponse other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Request, Request) && Equals(other.ResponseStatus, ResponseStatus); }