コード例 #1
0
        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);
        }
コード例 #2
0
        public void ModifyStore_1()
        {
            int ExpectedOutput = 1;
            int GotOutput      = 0;
            CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate();
            Stores StoresObj = new Stores();

            StoresObj.SetStoreID(7);
            StoresObj.SetStoreName("Walmart_Test");
            StoresObj.SetStoreLogo("images\\walmart_test.png");
            try
            {
                GotOutput = StoresTemplateObj.Update(StoresObj);
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(ExpectedOutput, GotOutput);
            // Modfying Store to its original values
            StoresObj.SetStoreID(7);
            StoresObj.SetStoreName("Walmart");
            StoresObj.SetStoreLogo("images\\walmart.png");
            StoresTemplateObj.Update(StoresObj);
        }
コード例 #3
0
        public void FetchStoreTest_1()
        {
            CRUDTemplate <IStores> StoresObj = new StoresTemplate();
            List <IStores>         Output    = StoresObj.Select();

            Assert.AreEqual(Output.Count > 0, true);
        }
コード例 #4
0
        public void RemoveStore_3()
        {
            int ExpectedOutput = 0;
            int GotOutput      = -1;
            CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate();
            Stores StoresObj = new Stores();

            StoresObj.SetStoreID(100);
            try
            {
                GotOutput = StoresTemplateObj.Delete(StoresObj);
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(ExpectedOutput, GotOutput);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void ModifyStore_4()
        {
            int ExpectedOutput = -2;
            int GotOutput      = -1;
            CRUDTemplate <IStores> StoresTemplateObj = new StoresTemplate();
            Stores StoresObj = new Stores();

            StoresObj.SetStoreID(7);
            StoresObj.SetStoreName(null);
            StoresObj.SetStoreLogo("images\\walmart_test.png");
            try
            {
                GotOutput = StoresTemplateObj.Update(StoresObj);
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(ExpectedOutput, GotOutput);
        }
コード例 #7
0
        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);
        }