Пример #1
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);
     }
 }
Пример #2
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);
     }
 }