public void TestListCityByNameAndState()
 {
     // Arrange
     LocationModel model = new LocationModel(new FakeUnitOfWork());
     // Act
     IList<CS_City> result = model.ListCityByNameAndState(2, "City 1");
     // Assert
     Assert.IsNotNull(result);
     Assert.AreEqual(result.Count, 1);
 }
        public void TestListCityByNameWithoutState()
        {
            //Arrange
            FakeObjectSet<CS_City> fakeCityList = new FakeObjectSet<CS_City>();
            fakeCityList.AddObject(new CS_City() { ID = 1, Active = true, Name = "City 1" });
            Mock<IUnitOfWork> mock = new Mock<IUnitOfWork>();
            mock.Setup(e => e.CreateObjectSet<CS_City>()).Returns(fakeCityList);
            LocationModel model = new LocationModel(mock.Object);

            //Act
            IList<CS_City> city = model.ListCityByNameAndState(0, "City 1");

            //Assert
            Assert.AreEqual(1, city.Count);
            Assert.IsNotNull(city);
        }
 public void ListCityByNameAndState()
 {
     try
     {
         using (_locationModel = new LocationModel())
         {
             _view.CityList = _locationModel.ListCityByNameAndState(int.Parse(_view.ContextKey), _view.PrefixText);
         }
     }
     catch (Exception ex)
     {
         Logger.Write(string.Format("An Error has ocurred while trying to load the City Information!\n{0}\n{1}", ex.Message, ex.StackTrace));
     }
 }