public void AddStore_1() { int ExpectedOutput = 1; int GotOutput = 0; CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate(); Stores StoresObj = new Stores(); StoresObj.SetStoreName("Test_Store"); StoresObj.SetStoreLogo("images\test.png"); try { GotOutput = StoresTemplateObj.Insert(StoresObj); } catch (Exception) { GotOutput = -2; } Assert.AreEqual(ExpectedOutput, GotOutput); // Deleting newely added Store List <IStores> Output = StoresTemplateObj.Select(); foreach (Stores Store in Output) { if ("Test_Store" == Store.GetStoreName()) { int StoreID = Store.GetStoreID(); StoresObj.SetStoreID(StoreID); break; } } StoresTemplateObj.Delete(StoresObj); }
public void AddStore_4() { int ExpectedOutput = -2; int GotOutput = 0; CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate(); Stores StoresObj = new Stores(); StoresObj.SetStoreName("Test_Store"); StoresObj.SetStoreLogo(null); try { GotOutput = StoresTemplateObj.Insert(StoresObj); } catch (Exception) { GotOutput = -2; } Assert.AreEqual(ExpectedOutput, GotOutput); }
public void RemoveStore_1() { int ExpectedOutput = 1; int GotOutput = 0; CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate(); Stores StoresObj = new Stores(); StoresObj.SetStoreName("Test_Store"); StoresObj.SetStoreLogo("images\test.png"); StoresTemplateObj.Insert(StoresObj); List <IStores> Output = StoresTemplateObj.Select(); foreach (Stores Store in Output) { if ("Test_Store" == Store.GetStoreName()) { int StoreID = Store.GetStoreID(); StoresObj.SetStoreID(StoreID); break; } } GotOutput = StoresTemplateObj.Delete(StoresObj); Assert.AreEqual(ExpectedOutput, GotOutput); }