示例#1
0
        private void myInit()
        {
            DataAccessDriver.UseStub = true;
            addTestStoreOwner1ToSystem();
            //set store and owner
            ownerObserver  = new testObserverAcceptence();
            storeOwnerUser = new LoginProxy();
            string loginAns   = storeOwnerUser.login(getStoreOwner1(), password);
            bool   loginError = loginAns == LoginProxy.successMsg;

            Assert.IsTrue(loginError, "can't log in");
            //set admin
            adminObserver = new testObserverAcceptence();
            adminUserL    = new LoginProxy();
            string loginAnsAdmin = adminUserL.login(adminUser, adminPass);
            bool   loginAdmin    = loginAnsAdmin == LoginProxy.successMsg;

            Assert.IsTrue(loginAdmin, "can't log in Admin");
        }
示例#2
0
        private void closeStoreByAdminLiveNotification()
        {
            testObserverAcceptence managerObserver = null;
            LoginProxy             manager         = null;

            try
            {
                myInit();

                bool subscribe1 = storeOwnerUser.subscribeAsObserver(ownerObserver);
                Assert.IsTrue(subscribe1, "can't subscribe");
                //add manager
                addTestStoreManager1ToSystem();
                manager = new LoginProxy();
                //sign in and subscribe observer
                bool login = manager.login(getStoreManager1(), password) == LoginProxy.successMsg;
                Assert.IsTrue(login, "can't login manager");
                managerObserver = new testObserverAcceptence();
                bool subscribe2 = storeOwnerUser.subscribeAsObserver(managerObserver);
                Assert.IsTrue(subscribe2, "can't subscribe manger as observer");
                //close store as admin
                LoginProxy admin      = new LoginProxy();
                bool       adminLogin = admin.login("Admin", "Admin") == LoginProxy.successMsg;
                Assert.IsTrue(adminLogin, "can't login Admin");
                admin.closeStore(storeId); //TODO fix fails because admin can't close sotres

                bool hasMessages1 = ownerObserver.msg.Count == 1;
                Assert.IsTrue(hasMessages1, "owner didn't recieve message on close");

                bool hasMessages2 = managerObserver.msg.Count == 1;
                Assert.IsTrue(hasMessages2, "admin didn't recieve message on close");
            }
            finally
            {
                if (managerObserver != null & manager != null)
                {
                    manager.unSubscribeAsObserver(managerObserver);
                }
                myCleanUp();
            }
        }