Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string thesearchtext, thecitytype;
- thesearchtext = HttpContext.Current.Request.QueryString["s"].ToString();
- thecitytype = HttpContext.Current.Request.QueryString["bt"].ToString();
- cannot implicitly convert type 'string' to 'bool'
- int listingsToSearch;
- if (thecitytype = "City1")
- {
- listingsToSearch = Convert.ToInt32(1);
- }
- else
- {
- listingsToSearch = Convert.ToInt32(2);
- }
- if (thecitytype == "City1")
- listingsToSearch = 1;
- [Test]
- public void testGetCityToSearch()
- {
- // if thecitytype = "City1", listingToSearch = 1
- // if thecitytype = "City2", listingToSearch = 2
- doParseCity(1, "City1");
- doParseCity(2, "City2");
- doParseCity(20, "City20");
- }
- public void doParseCity(int expected, string input )
- {
- int listingsToSearch;
- string cityNum = input.Substring(4);
- bool parseResult = Int32.TryParse(cityNum, out listingsToSearch);
- Assert.IsTrue(parseResult);
- Assert.AreEqual(expected, listingsToSearch);
- }
- string thecitytype20 = "City20";
- string cityNum20 = thecitytype20.Substring(4);
- bool parseResult20 = Int32.TryParse(cityNum20, out listingsToSearch);
- // parseResult20 tells you whether parse succeeded, listingsToSearch will give you 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement