예제 #1
0
 public void CityServiceConstructorTest()
 {
     IEmpDBContext CityDBContext = null; // TODO: Initialize to an appropriate value
     CityService target = new CityService(CityDBContext);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
예제 #2
0
        public void GetAllCitiesTest()
        {
            CityService target = new CityService(dbContext); // TODO: Initialize to an appropriate value
            City expected1 = new City();
            City expected2 = new City();

            expected1.CityID = 1;
            expected2.CityID = 2;

            expected1.CityName = "DeKalb";
            expected2.CityName = "Washington";

            dbContext.Cities.Add(expected1);
            dbContext.Cities.Add(expected2);

            List<City> expected = new List<City>(); // TODO: Initialize to an appropriate value
            expected.Add(expected1);
            expected.Add(expected2);
            List<City> actual;
            //city needs stateid
            actual = target.GetAllCities(expected.Count);
            Assert.AreEqual(expected.Count, actual.Count);
            Assert.AreEqual(expected[0].CityID, actual[0].CityID);
            Assert.AreEqual(expected[1].CityName, expected[1].CityName);

            dbContext.Cities.Remove(expected1);
            dbContext.Cities.Remove(expected2);
        }
예제 #3
0
        public void GetCityTest()
        {
            CityService target = new CityService(dbContext);
            City expected = new City();
            expected.CityID = 1;
            expected.CityName = "city";
            dbContext.Cities.Add(expected);
            dbContext.SaveChanges();

            City actual;
            actual = target.GetCity(expected.CityID);
            Assert.AreEqual(expected, actual);
            dbContext.Cities.Remove(expected);
        }