public void TestStatesRetrieval() { var mockStateRepository = new Mock<IStateRepository>(); var states = new List<State>() { new State() { Abbreviation = "NJ" }, new State() { Abbreviation = "NY" }, new State() { Abbreviation = "AR" } }; mockStateRepository.Setup(repository => repository.Get(true)) .Returns(states); var geoService = new GeoManager(mockStateRepository.Object); var data = geoService.GetStates(true).ToList(); var statesAbbr = states.Select(state => state.Abbreviation).ToList(); Assert.IsTrue(!statesAbbr.Except(data).Any()); Assert.IsTrue(statesAbbr.Count == data.Count); }
public void GetStatesCheck() { IGeoService geoManager = new GeoManager(); List<string> result = geoManager.GetStates(true).ToList(); Assert.IsTrue(result.Count > 0); }