コード例 #1
0
 private void Seed()
 {
     using (var context = new Entity.FannerDogsDBContext(options)){
         context.Database.EnsureDeleted();
         context.Database.EnsureCreated();
     }
 }
コード例 #2
0
 /// <summary>
 /// Checks FindItem to make sure it returns null correctly if Item quantity is too high
 /// </summary>
 public void WrongItemShouldNotBeFound()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo            _repoDS    = new Repo(context);
         Model.DogManager dogManager = new Model.DogManager(1234567890, "Test, TX", "Texas Toaster");
         _repoDS.AddManager
         (
             dogManager
         );
         Model.StoreLocation storeLocation = new Model.StoreLocation("Test, TX", "Test Dogs");
         _repoDS.AddStoreLocation(
             storeLocation,
             dogManager
             );
         Model.Dog dog = new Model.Dog("Special Breed", 'f', 1000);
         _repoDS.AddItem(
             storeLocation,
             dog,
             5
             );
         Model.Item item = _repoDS.FindItem(
             storeLocation,
             dog,
             20
             );
         bool itemNotThere = (item == null);
         bool expected     = true;
         Assert.Equal(itemNotThere, expected);
     }
 }
コード例 #3
0
 /// <summary>
 /// Makes sure store inventory is being updated
 /// </summary>
 public void AddItemShouldBeInStoreInventory()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo            _repoDS    = new Repo(context);
         Model.DogManager dogManager = new Model.DogManager(1234567890, "Test, TX", "Texas Toaster");
         _repoDS.AddManager
         (
             dogManager
         );
         Model.StoreLocation storeLocation = new Model.StoreLocation("Test, TX", "Test Dogs");
         _repoDS.AddStoreLocation(
             storeLocation,
             dogManager
             );
         Model.Dog dog = new Model.Dog("Special Breed", 'f', 1000);
         _repoDS.AddItem(
             storeLocation,
             dog,
             5
             );
         List <Model.Item> items = _repoDS.GetStoreInventory(
             storeLocation.Address,
             storeLocation.Location
             );
         int expected = 1;
         Assert.Equal(items.Count(), expected);
     }
 }
コード例 #4
0
 /// <summary>
 /// Checks AddBuyer and FindBuyer
 /// </summary>
 public void AddBuyerAddsBuyer()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo          _repoDS  = new Repo(context);
         Model.DogBuyer dogBuyer = new Model.DogBuyer("Texas Toaster", "Test, TX", 1234567890);
         _repoDS.AddBuyer
         (
             dogBuyer
         );
         Model.DogBuyer dogBuyerReturned = _repoDS.FindBuyer(1234567890);
         Assert.Equal(dogBuyerReturned.PhoneNumber, dogBuyer.PhoneNumber);
     }
 }
コード例 #5
0
 /// <summary>
 /// Checks FindManager to make sure it returns null appropriately
 /// </summary>
 public void WrongManagerShouldNotBeFound()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo            _repoDS    = new Repo(context);
         Model.DogManager dogManager = new Model.DogManager(1234567890, "Test, TX", "Texas Toaster");
         _repoDS.AddManager
         (
             dogManager
         );
         Model.DogManager dogManagerReturned = _repoDS.FindManager(3214567890);
         bool             managerNotThere    = (dogManagerReturned == null);
         bool             expected           = true;
         Assert.Equal(managerNotThere, expected);
     }
 }
コード例 #6
0
 /// <summary>
 /// Checks GetAllDogManagers
 /// </summary>
 public void GetAllManagersGetsManagers()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo            _repoDS    = new Repo(context);
         Model.DogManager dogManager = new Model.DogManager(9638527410, "Wired, Wyoming", "Ama Test");
         _repoDS.AddManager
         (
             dogManager
         );
         dogManager = new Model.DogManager(1234567890, "Test, TX", "Texas Toaster");
         _repoDS.AddManager
         (
             dogManager
         );
         List <Model.DogManager> dogManagers = _repoDS.GetAllDogManagers();
         int expected = 2;
         Assert.Equal(dogManagers.Count, expected);
     }
 }
コード例 #7
0
 /// <summary>
 /// Checks AddStoreLocation and FindStore
 /// </summary>
 public void AddStoreLocationAddsStore()
 {
     using (var context = new Entity.FannerDogsDBContext(options))
     {
         IRepo            _repoDS    = new Repo(context);
         Model.DogManager dogManager = new Model.DogManager(1234567890, "Test, TX", "Texas Toaster");
         _repoDS.AddManager
         (
             dogManager
         );
         _repoDS.AddStoreLocation(
             new Model.StoreLocation("Test, TX", "Test Dogs"),
             dogManager
             );
         Model.StoreLocation store = _repoDS.FindStore("Test, TX", "Test Dogs");
         bool storeThere           = (store != null);
         bool expected             = true;
         Assert.Equal(storeThere, expected);
     }
 }
コード例 #8
0
 public OrderBL(Entity.FannerDogsDBContext context)
 {
     _repoDS = new Repo(context);
 }
コード例 #9
0
 public Repo(Entity.FannerDogsDBContext context)
 {
     _context = context;
     Log.Debug("Created an instance of the repository");
 }
コード例 #10
0
 public StoreLocationBL(Entity.FannerDogsDBContext context)
 {
     _repoDS = new Repo(context);
 }