コード例 #1
0
 public Location AddLocation(Location newLocation)
 {
     if (LocationExists(newLocation))
     {
         throw new Exception("Location already exists");
     }
     return(_locationDB.AddLocation(newLocation));
 }
コード例 #2
0
        public void AddLocationWorks()
        {
            using (var context = new Entity.p0storeContext(options)){
                LocationDB _locationDB = new LocationDB(context);
                _locationDB.AddLocation(new Model.Location("new location", "123 new location"));
            }

            using (var assertContext = new Entity.p0storeContext(options)){
                var location = assertContext.Locations.FirstOrDefault(loca => loca.LocationName == "new location" && loca.LocationAddress == "123 new location");
                Assert.NotNull(location);
            }
        }