예제 #1
0
        public void DeleteItemListing_InvalidItemListing()
        {
            setup();
            itemListingToTest.ItemListID = 99;

            int actual = ItemListingAccessor.DeleteItemListing(itemListingToTest);

            if (actual == 0)
            {
                throw new ApplicationException("Concurrency Error");
            }
        }
예제 #2
0
 /// <summary>
 /// Matt Lapka
 /// Created: 2015/02/14
 /// Archive an ItemListing so it does not appear in active searches
 /// </summary>
 /// <param name="itemListToDelete">ItemListing object containing the information to delete</param>
 /// <returns>An int reflecting number of rows affected</returns>
 public listResult ArchiveItemListing(ItemListing itemListToDelete)
 {
     try
     {
         if (itemListToDelete.CurrentNumGuests == 0)
         {
             if (ItemListingAccessor.DeleteItemListing(itemListToDelete) == 1)
             {
                 DataCache._currentItemListingList = ItemListingAccessor.GetItemListingList();
                 return(listResult.Success);
             }
         }
         return(listResult.NotChanged);
     }
     catch (Exception)
     {
         return(listResult.DatabaseError);
     }
 }
예제 #3
0
        public void DeleteItemListing_ValidItemListing()
        {
            int expected = 1;

            setup();

            SupplierAccessor.AddSupplier(testSupp, "Test", "Password#1");
            modSupp = getSupplierListCompName(suppList);
            itemListingToTest.SupplierID = modSupp.SupplierID;
            ItemListingAccessor.AddItemListing(itemListingToTest);
            itemListingToTest = getItemListingTestObject(itemList);

            int actual = ItemListingAccessor.DeleteItemListing(itemListingToTest);

            ItemListingAccessor.DeleteItemListingTestItem(itemListingToTest);
            testSupp.SupplierID = modSupp.SupplierID;
            testLog             = sLA.RetrieveSupplierLogin("Password#1", "Test");
            SupplierLoginAccessor.DeleteTestSupplierLogin(testLog);
            TestCleanupAccessor.DeleteTestSupplier(testSupp);

            Assert.AreEqual(expected, actual);
        }