private void myCleanUp() { storeOwnerUser.unSubscribeAsObserver(ownerObserver); adminUserL.unSubscribeAsObserver(adminObserver); Cleanup(); DataAccessDriver.UseStub = false; }
/// <summary> /// on close event activated when the connection is closed /// </summary> public void onClose() { bool ans = user.unSubscribeAsObserver(this); if (!ans) { Logger.Log("error", logLevel.ERROR, "couldn't unsubscribe observer"); } }
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(); } }