public void locationTest() { double Lat = 2.0; double Long = 79.0; string marketName = "Times Market"; string city = "New York"; string location = "Broadway"; Market target = new Market(Lat, Long, marketName, city, location); //** First Test **// string marketLoc = target.location; Assert.IsNotNull(marketLoc); //** Second Test **// Assert.AreEqual(target.location, location); }
public bool addMarketToDb(Market mk) { Market inmk = new Market(); try { inmk = db.markets.Add(mk); } catch (Exception e) { Exception j = e; return false; //do something } if (inmk is Market) { db.SaveChanges(); return true; } return false; }
public List<Models.Market> parseMarkets() { CsvReader csv = new CsvReader(reader, true); int fieldCount = csv.FieldCount; List<Market> exList = new List<Market>(); Market exObj = null; String[] headers = csv.GetFieldHeaders(); while (csv.ReadNextRecord()) { string cityStr = null; double lat = 0, lng = 0; string theName = null, location = null; for (int i = 0; i < fieldCount; i++) { // this is where you actually create your dB object if (headers[i].Equals("Shape")) { parseShape(csv[i], ref lat, ref lng); } else if (headers[i].Equals("NAME")) { theName = csv[i]; } else if (headers[i].Equals("CITY")) { cityStr = csv[i]; } else if (headers[i].Equals("LOCATION")) { location = csv[i]; } } exObj = new Market(lat, lng, theName, cityStr, location); exList.Add(exObj); } return exList; //throw new NotImplementedException(); }
public void MarketConstructorTest() { double Lat = 2.0; double Long = 79.0; string marketName = "Times Market"; string city = "New York"; string location = "Broadway"; Market target = new Market(Lat, Long, marketName, city, location); //** First Test **// Assert.AreEqual(target.location, location); //** Second Test **// string marketCity = target.cityStr; Assert.IsNotNull(marketCity); //** Third Test **// bool actual = false; if(target is Market) { actual = true; } bool expected = true; Assert.AreEqual(expected, actual); }
/// <summary> ///A test for shape ///</summary> public void shapeTest() { Market target = new Market(); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; target.shape = expected; actual = target.shape; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void MarketIDTest() { Market target = new Market(); int expected = 0; int actual; target.MarketID = expected; actual = target.MarketID; Assert.AreEqual(expected, actual); }
public bool updateMarketInDb(Market mk) { db.Entry(mk).State = EntityState.Modified; try { db.SaveChanges(); return true; } catch (Exception e) { // do something return false; } }