public void AddDelegate(DelegateData delegateData) { var sessionDelegate = new SessionDelegate(delegateData); delegateRepository.Insert(sessionDelegate); delegateRepository.Save(); }
public ISession OpenSession(String alias) { if (alias == null) { throw new ArgumentNullException("alias"); } ITransaction transaction = ObtainCurrentTransaction(); bool weAreSessionOwner = false; SessionDelegate wrapped = sessionStore.FindCompatibleSession(alias); ISession session = null; if (wrapped == null) { session = CreateSession(alias); weAreSessionOwner = true; wrapped = WrapSession(transaction != null, session); sessionStore.Store(alias, wrapped); EnlistIfNecessary(weAreSessionOwner, transaction, wrapped); } else { if (EnlistIfNecessary(weAreSessionOwner, transaction, wrapped)) { wrapped = WrapSession(true, wrapped.InnerSession); } } return(wrapped); }
/// <summary> /// Should remove the session from the store /// only. /// </summary> /// <param name="session"></param> public void Remove(SessionDelegate session) { var stack = (Stack) session.SessionStoreCookie; if (stack == null) { throw new InvalidProgramException("AbstractSessionStore.Remove called " + "with no cookie - no pun intended"); } if (stack.Count == 0) { throw new InvalidProgramException("AbstractSessionStore.Remove called " + "for an empty stack"); } var current = stack.Peek() as ISession; if (session != current) { throw new InvalidProgramException("AbstractSessionStore.Remove tried to " + "remove a session which is not on the top or not in the stack at all"); } stack.Pop(); }
public void FindCompatibleSessionWithTwoThreads() { ISessionStore store = (ISessionStore) container[typeof(ISessionStore)]; ISessionFactory factory = (ISessionFactory) container[typeof(ISessionFactory)]; ISession session = factory.OpenSession(); SessionDelegate sessDelegate = new SessionDelegate(true, session, store); store.Store( Constants.DefaultAlias, sessDelegate ); ISession session2 = store.FindCompatibleSession( Constants.DefaultAlias ); Assert.IsNotNull(session2); Assert.AreSame(sessDelegate, session2); Thread newThread = new Thread(new ThreadStart(FindCompatibleSessionOnOtherThread)); newThread.Start(); arEvent.WaitOne(); sessDelegate.Dispose(); Assert.IsTrue( store.IsCurrentActivityEmptyFor( Constants.DefaultAlias ) ); }
public void Handle(AddDelegateCommand command) { var sessionDelegate = new SessionDelegate(command); delegateRepository.Insert(sessionDelegate); delegateRepository.Save(); }
public void FindCompatibleSessionWithTwoThreads() { ISessionStore store = container.Resolve <ISessionStore>(); ISessionFactory factory = container.Resolve <ISessionFactory>(); ISession session = factory.OpenSession(); SessionDelegate sessDelegate = new SessionDelegate(true, session, store); store.Store(Constants.DefaultAlias, sessDelegate); ISession session2 = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNotNull(session2); Assert.AreSame(sessDelegate, session2); Thread newThread = new Thread(FindCompatibleSessionOnOtherThread); newThread.Start(); arEvent.WaitOne(); sessDelegate.Dispose(); Assert.IsTrue(store.IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
public ActionResult LoadDelegates() { string fileName = "delegateslist.csv"; string directoryPath = Server.MapPath("~"); StreamReader stream = new StreamReader(directoryPath + fileName); int counter = 0; while (!stream.EndOfStream) { var line = stream.ReadLine(); var value = line.Split(','); if (value != null) { SessionDelegate newSessionDelegate = new SessionDelegate() { NameTitle = value[0], FirstName = value[1], LastName = value[2], InstitutionId = Convert.ToInt32(value[3]), DelegateType = value[4], DateAdded = DateTime.Now }; db.SessionDelegates.Add(newSessionDelegate); db.SaveChanges(); counter += 1; } } TempData["Success"] = counter + " SessionDelegates were successfully added."; return(RedirectToAction("Index")); }
/// <summary> /// Should remove the session from the store /// only. /// </summary> /// <param name="session"></param> public void Remove(SessionDelegate session) { var stack = (Stack)session.SessionStoreCookie; if (stack == null) { throw new InvalidProgramException("AbstractSessionStore.Remove called " + "with no cookie - no pun intended"); } if (stack.Count == 0) { throw new InvalidProgramException("AbstractSessionStore.Remove called " + "for an empty stack"); } var current = stack.Peek() as ISession; if (session != current) { throw new InvalidProgramException("AbstractSessionStore.Remove tried to " + "remove a session which is not on the top or not in the stack at all"); } stack.Pop(); }
public void FindCompatibleSessionWithTwoThreads() { var store = container.Resolve<ISessionStore>(); var factory = container.Resolve<ISessionFactory>(); ISession session = factory.OpenSession(); var sessDelegate = new SessionDelegate(true, session, store); store.Store(Constants.DefaultAlias, sessDelegate); ISession session2 = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNotNull(session2); Assert.AreSame(sessDelegate, session2); var newThread = new Thread(FindCompatibleSessionOnOtherThread); newThread.Start(); arEvent.WaitOne(); sessDelegate.Dispose(); Assert.IsTrue(store.IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
/// <summary> /// Should store the specified session instance /// </summary> /// <param name="alias"></param> /// <param name="session"></param> public void Store(String alias, SessionDelegate session) { Stack stack = GetStackFor(alias); stack.Push(session); session.SessionStoreCookie = stack; }
/// <summary> /// Should store the specified session instance /// </summary> /// <param name="alias"></param> /// <param name="session"></param> public void Store(String alias, SessionDelegate session) { var stack = GetStackFor(alias); stack.Push(session); session.SessionStoreCookie = stack; }
public async Task <ActionResult> DeleteConfirmed(int id) { SessionDelegate sessionDelegate = await db.SessionDelegates.FindAsync(id); db.SessionDelegates.Remove(sessionDelegate); await db.SaveChangesAsync(); TempData["Success"] = "1 Delegate Information deleted!"; return(RedirectToAction("Index")); }
public async Task <ActionResult> CancelRegistration(int?id) { if (id == null) { } SessionDelegate sessionDelegate = await db.SessionDelegates.FindAsync(id); return(View(sessionDelegate)); }
public void PerformPieceOfOperation(ISession prevSession) { Assert.IsNotNull(prevSession); using (ISession sess = sessManager.OpenSession()) { Assert.IsNotNull(sess); Assert.IsTrue(SessionDelegate.AreEqual(sess, prevSession)); } }
private void DoConnect() { OTError error; _sesionDelegate = new SessionDelegate(this); _session = new OTSession(Configuration.Config.API_KEY, Configuration.Config.SESSION_ID, _sesionDelegate); _session.ConnectWithToken(Configuration.Config.TOKEN, out error); }
protected bool EnlistIfNecessary(bool weAreSessionOwner, ITransaction transaction, SessionDelegate session) { if (transaction == null) { return(false); } IList list = (IList)transaction.Context["nh.session.enlisted"]; bool shouldEnlist = false; if (list == null) { list = new ArrayList(); list.Add(session); transaction.Context["nh.session.enlisted"] = list; shouldEnlist = true; } else { shouldEnlist = true; foreach (ISession sess in list) { if (SessionDelegate.AreEqual(session, sess)) { shouldEnlist = false; break; } } } if (shouldEnlist) { // TODO: propagate IsolationLevel, expose as transaction property transaction.Enlist(new ResourceAdapter(session.BeginTransaction())); if (weAreSessionOwner) { transaction.RegisterSynchronization( new SessionDisposeSynchronization(session)); } } return(true); }
public async Task <ActionResult> Edit([Bind(Include = "Id,FirstName,LastName,NameTitle,DateAdded,InstitutionId,Address,Email,AgeGroup,MartialStatus,Gender,Telephone,RequireHousing,EmergencyContactName,EmergencyContactPhone,DelegateType,Allergies,Asthma,Diabetes,Vegetarian,HighBloodPressure,BronchialDisorder")] SessionDelegate sessionDelegate) { if (ModelState.IsValid) { db.Entry(sessionDelegate).State = EntityState.Modified; await db.SaveChangesAsync(); TempData["Success"] = sessionDelegate.FirstName + " " + sessionDelegate.LastName + " record successfully updated."; return(RedirectToAction("Index")); } return(View(sessionDelegate)); }
public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SessionDelegate sessionDelegate = await db.SessionDelegates.FindAsync(id); if (sessionDelegate == null) { return(HttpNotFound()); } return(View(sessionDelegate)); }
public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SessionDelegate sessionDelegate = await db.SessionDelegates.FindAsync(id); if (sessionDelegate == null) { return(HttpNotFound()); } ViewBag.InstitutionList = new SelectList(db.Institutions.OrderBy(v => v.Name), "Id", "Name").ToList(); return(View(sessionDelegate)); }
// [Ignore("This doesn't work with the NH 1.2 transaction property, needs to be fixed")] public void NewTransactionAfterUsingSession() { ISessionManager manager = container.Resolve <ISessionManager>(); ISession session1 = manager.OpenSession(); ITransactionManager tmanager = container.Resolve <ITransactionManager>(); ITransaction transaction = tmanager.CreateTransaction( TransactionMode.Requires, IsolationMode.Serializable); transaction.Begin(); // Nested using (ISession session2 = manager.OpenSession()) { Assert.IsNotNull(session2); Assert.IsNotNull(session1); Assert.IsNotNull(session1.Transaction, "After requesting compatible session, first session is enlisted in transaction too."); Assert.IsTrue(session1.Transaction.IsActive, "After requesting compatible session, first session is enlisted in transaction too."); using (ISession session3 = manager.OpenSession()) { Assert.IsNotNull(session3); Assert.IsNotNull(session3.Transaction); Assert.IsTrue(session3.Transaction.IsActive); } SessionDelegate delagate1 = (SessionDelegate)session1; SessionDelegate delagate2 = (SessionDelegate)session2; Assert.AreSame(delagate1.InnerSession, delagate2.InnerSession); } transaction.Commit(); // TODO: Assert transaction was committed // Assert.IsTrue(session1.Transaction.WasCommitted); Assert.IsTrue(session1.IsConnected); session1.Dispose(); Assert.IsTrue(container.Resolve <ISessionStore>().IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
/// <summary> /// Выполнить действия при запуске линии связи /// </summary> public override void OnCommLineStart() { // получение режима передачи данных try { transMode = (Modbus.TransModes)Enum.Parse(typeof(Modbus.TransModes), UserParams["TransMode"], true); } catch { transMode = Modbus.TransModes.RTU; } // настройка библиотеки в зависимости от режима передачи данных switch (transMode) { case Modbus.TransModes.RTU: session += SerialSession; sendCmd += SerialSendCmd; request += modbus.RtuRequest; break; case Modbus.TransModes.ASCII: session += SerialSession; sendCmd += SerialSendCmd; request += modbus.AsciiRequest; SerialPort.NewLine = Modbus.CRLF; break; default: // Modbus.TransModes.TCP session += TcpSession; sendCmd += TcpSendCmd; request += modbus.TcpRequest; break; } // настройка объекта, реализующего протокол Modbus modbus.SerialPort = SerialPort; modbus.Timeout = KPReqParams.Timeout; modbus.WriteToLog = WriteToLog; // формирование PDU и ADU if (deviceModel != null) { devAddr = (byte)Address; foreach (Modbus.ElemGroup elemGroup in deviceModel.ElemGroups) { elemGroup.InitReqPDU(); elemGroup.InitReqADU(devAddr, transMode); } } }
public async Task <ActionResult> Create([Bind(Include = "FirstName,LastName,NameTitle,InstitutionId,Address,Email,AgeGroup,MartialStatus,Gender,Telephone,RequireHousing,EmergencyContactName,EmergencyContactPhone,DelegateType,Allergies,Asthma,Diabetes,Vegetarian,HighBloodPressure,BronchialDisorder")] SessionDelegateViewModel sessionDelegateViewModel) { if (ModelState.IsValid) { SessionDelegate newMap = Mapper.Map <SessionDelegate>(sessionDelegateViewModel); newMap.DateAdded = DateTime.Now; db.SessionDelegates.Add(newMap); await db.SaveChangesAsync(); TempData["Success"] = "1 Delegate Successfully Added to List."; return(RedirectToAction("Index")); } ViewBag.InstitutionList = new SelectList(db.Institutions, "Id", "Name").ToList(); return(View(sessionDelegateViewModel)); }
public ISession OpenSession(string alias = null) { alias = NormaliseAlias(alias); var canClose = false; var unbindOnClose = false; var sessionFactory = _sessionFactoryResolver.GetSessionFactory(alias); ISession session; // First rule is that if there is a session in the current context, use it. if (CurrentSessionContext.HasBind(sessionFactory)) { session = sessionFactory.GetCurrentSession(); } else { // Second rule is try to find from dervived class's storage mechanism (if any exists). session = FindCompatibleSession(alias, sessionFactory); if (session != null) { // want to unbind when the session delegate is closed, // but do not close the session as it is pre-existing unbindOnClose = true; CurrentSessionContext.Bind(session); } else { session = CreateNewSession(alias, sessionFactory); CurrentSessionContext.Bind(session); canClose = true; unbindOnClose = true; } } var sessionDelegate = new SessionDelegate(canClose, session); if (unbindOnClose) { sessionDelegate.Closed += (o, e) => CurrentSessionContext.Unbind(sessionFactory); } return sessionDelegate; }
public void SharedSession() { var manager = container.Resolve <ISessionManager>(); ISession session1 = manager.OpenSession(); ISession session2 = manager.OpenSession(); ISession session3 = manager.OpenSession(); Assert.IsNotNull(session1); Assert.IsNotNull(session2); Assert.IsNotNull(session3); Assert.IsTrue(SessionDelegate.AreEqual(session1, session2)); Assert.IsTrue(SessionDelegate.AreEqual(session1, session3)); session3.Dispose(); session2.Dispose(); session1.Dispose(); Assert.IsTrue(container.Resolve <ISessionStore>().IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
public async Task <ActionResult> ConfirmRegistration(int id) { int NumberOfDelegatesAssigned = 0; int NumberOfDelegatesRegistered = 0; SessionDelegate sessionDelegate = await db.SessionDelegates.Include(a => a.Registered).FirstOrDefaultAsync(a => a.Id == id); NumberOfDelegatesAssigned = sessionDelegate.Institution.NumberOfDelegatesAssigned; NumberOfDelegatesRegistered = await db.Registered.CountAsync(a => a.SessionDelegate.InstitutionId == sessionDelegate.InstitutionId); if (NumberOfDelegatesRegistered >= NumberOfDelegatesAssigned) { TempData["Error"] = sessionDelegate.Institution.Name + " has reached the limit for number of delegates."; return(RedirectToAction("Index")); } Registered NewRegistration = new Registered() { SessionDelegateId = id, ApplicationUserId = User.Identity.GetUserId(), DateAndTime = DateTime.Now }; db.Registered.Add(NewRegistration); await db.SaveChangesAsync(); //send email to user string delegateEmail = sessionDelegate.Email; if (!string.IsNullOrEmpty(delegateEmail)) { //send email await UserManager.SendEmailAsync(User.Identity.GetUserId(), "Welcome to CJC Conference Session", "You have been registered for the 5th Quadrennial Conference Session. Welcome!"); } TempData["Success"] = "1 Delegate Successfully Registered"; return(RedirectToAction("Index")); }
public void FindCompatibleSession() { ISessionStore store = container.Resolve<ISessionStore>(); ISessionFactory factory = container.Resolve<ISessionFactory>(); ISession session = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNull(session); session = factory.OpenSession(); SessionDelegate sessDelegate = new SessionDelegate(true, session, store); store.Store(Constants.DefaultAlias, sessDelegate); Assert.IsNotNull(sessDelegate.SessionStoreCookie); ISession session2 = store.FindCompatibleSession("something in the way she moves"); Assert.IsNull(session2); session2 = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNotNull(session2); Assert.AreSame(sessDelegate, session2); session.Dispose(); store.Remove(sessDelegate); session = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNull(session); Assert.IsTrue(store.IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
public void FindCompatibleSession() { ISessionStore store = container.Resolve <ISessionStore>(); ISessionFactory factory = container.Resolve <ISessionFactory>(); ISession session = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNull(session); session = factory.OpenSession(); SessionDelegate sessDelegate = new SessionDelegate(true, session, store); store.Store(Constants.DefaultAlias, sessDelegate); Assert.IsNotNull(sessDelegate.SessionStoreCookie); ISession session2 = store.FindCompatibleSession("something in the way she moves"); Assert.IsNull(session2); session2 = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNotNull(session2); Assert.AreSame(sessDelegate, session2); session.Dispose(); store.Remove(sessDelegate); session = store.FindCompatibleSession(Constants.DefaultAlias); Assert.IsNull(session); Assert.IsTrue(store.IsCurrentActivityEmptyFor(Constants.DefaultAlias)); }
public void BeginTransaction_with_IsolationLevel() { var txMock = new Mock<ITransaction>(); var sessionImplMock = new Mock<ISessionImplementor>(); var sessionId = Guid.NewGuid(); _mock.Setup(s => s.Transaction).Returns(txMock.Object); _mock.Setup(s => s.GetSessionImplementation()).Returns(sessionImplMock.Object); sessionImplMock.Setup(s => s.SessionId).Returns(sessionId); // need to create the session delegate again, because it only makes sense after // setting up the transaction mocks _delegate = new SessionDelegate(true, _mock.Object); var tx = _delegate.BeginTransaction(IsolationLevel.RepeatableRead); Assert.IsInstanceOf<TransactionDelegate>(tx); Assert.AreSame(txMock.Object, ((TransactionDelegate)tx).InnerTransaction); txMock.Verify(t => t.Begin(IsolationLevel.RepeatableRead), Times.Exactly(1)); }
public void NestedSessionDelegates() { var delegate2 = new SessionDelegate(false, _delegate); // tests that the inner session for the new delegate is not // the first delegate, but rather the inner session for the first // delegate. Assert.AreSame(_delegate.InnerSession, delegate2.InnerSession); }
public void Dispose_with_CanClose_false() { _delegate.Closed += (obj, e) => Assert.Fail("Closed event should not be called"); // override the setup method _delegate = new SessionDelegate(false, _mock.Object); _delegate.Dispose(); _mock.Verify(s => s.Dispose(), Times.Never()); }
/// <summary> /// Enlists if necessary. /// </summary> /// <param name="weAreSessionOwner">if set to <c>true</c> [we are session owner].</param> /// <param name="transaction">The transaction.</param> /// <param name="session">The session.</param> /// <returns></returns> protected bool EnlistIfNecessary(bool weAreSessionOwner, ITransaction transaction, SessionDelegate session) { if (transaction == null) { Logger.Info("Tx not found. Nothing to do here."); return false; } Logger.InfoFormat("Enlistment status. Session: {0}. Tx IsActive: {1}. Are we Session Owner: {2}", session.GetSessionImplementation().SessionId, session.Transaction.IsActive, weAreSessionOwner); if (weAreSessionOwner && session.Transaction.IsActive) { Logger.Info("Enlisted Session " + session.GetSessionImplementation().SessionId); var ue = new UnregisterEnlistment(Logger, session.UnregisterFromStore, transaction); transaction.Inner.EnlistVolatile(ue, EnlistmentOptions.EnlistDuringPrepareRequired); } return true; }
/// <summary> Execute the action specified by the given action object within a /// EMS Session. /// </summary> /// <remarks> Generalized version of <code>execute(SessionCallback)</code>, /// allowing the EMS Connection to be started on the fly. /// <p>Use <code>execute(SessionCallback)</code> for the general case. /// Starting the EMS Connection is just necessary for receiving messages, /// which is preferably achieved through the <code>receive</code> methods.</p> /// </remarks> /// <param name="action">callback object that exposes the session /// </param> /// <param name="startConnection">Start the connection before performing callback action. /// </param> /// <returns> the result object from working with the session /// </returns> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public virtual object Execute(SessionDelegate action, bool startConnection) { AssertUtils.ArgumentNotNull(action, "Callback object must not be null"); IConnection conToClose = null; ISession sessionToClose = null; // bool sessionInTLS = true; //NOTE: Not closing session or connection unless session is not returned from // ConnectionFactoryUtils.DoGetTransactionalSession and CacheEmsResources is set to false try { ISession sessionToUse = ConnectionFactoryUtils.DoGetTransactionalSession(ConnectionFactory, transactionalResourceFactory, startConnection); if (sessionToUse == null) { //sessionInTLS = false; conToClose = CreateConnection(); sessionToClose = CreateSession(conToClose); if (startConnection) { conToClose.Start(); } sessionToUse = sessionToClose; } if (logger.IsDebugEnabled) { logger.Debug("Executing callback on EMS Session [" + sessionToUse + "]"); } return action(sessionToUse); } finally { EmsUtils.CloseSession(sessionToClose); ConnectionFactoryUtils.ReleaseConnection(conToClose, ConnectionFactory, startConnection); /* if (!sessionInTLS && !CacheEmsResources) { EmsUtils.CloseSession(session); ConnectionFactoryUtils.ReleaseConnection(con, ConnectionFactory, startConnection); }*/ } }
/// <summary> /// Execute the action specified by the given action object within /// a EMS Session. /// </summary> /// <param name="del">delegate that exposes the session</param> /// <returns> /// the result object from working with the session /// </returns> /// <remarks> /// <para>Note that the value of PubSubDomain affects the behavior of this method. /// If PubSubDomain equals true, then a Session is passed to the callback. /// If false, then a Session is passed to the callback.</para>b /// </remarks> /// <exception cref="EMSException">If there is any problem accessing the EMS API</exception> public object Execute(SessionDelegate del) { return Execute(new ExecuteSessionCallbackUsingDelegate(del)); }
/// <summary> /// Should store the specified session instance /// </summary> /// <param name="alias"></param> /// <param name="session"></param> public void Store(SessionDelegate session) { Stack stack = GetStackFor(); stack.Push(session); session.SessionStoreCookie = stack; }
public SessionDisposeSynchronization(SessionDelegate session) { this.session = session; }
/// <summary> /// Initializes a new instance of the <see cref="SessionDisposeSynchronization"/> class. /// </summary> /// <param name="session">The session.</param> public SessionDisposeSynchronization(SessionDelegate session) { this.session = session; }
/// <summary> /// Enlists if necessary. /// </summary> /// <param name="weAreSessionOwner">if set to <c>true</c> [we are session owner].</param> /// <param name="transaction">The transaction.</param> /// <param name="session">The session.</param> /// <returns></returns> protected bool EnlistIfNecessary(bool weAreSessionOwner, ITransaction transaction, SessionDelegate session) { if (transaction == null) return false; var list = (IList<ISession>) transaction.Context["nh.session.enlisted"]; bool shouldEnlist; if (list == null) { list = new List<ISession>(); shouldEnlist = true; } else { shouldEnlist = true; foreach (ISession sess in list) { if (SessionDelegate.AreEqual(session, sess)) { shouldEnlist = false; break; } } } if (shouldEnlist) { if (session.Transaction == null || !session.Transaction.IsActive) { transaction.Context["nh.session.enlisted"] = list; IsolationLevel level = TranslateIsolationLevel(transaction.IsolationMode); transaction.Enlist(new ResourceAdapter(session.BeginTransaction(level), transaction.IsAmbient)); list.Add(session); } if (weAreSessionOwner) { transaction.RegisterSynchronization(new SessionDisposeSynchronization(session)); } } return true; }
public void SetUp() { _mock = new Mock<ISession>(); _delegate = new SessionDelegate(true, _mock.Object); }
public void Close_with_CanClose_false() { // override the setup method _delegate = new SessionDelegate(false, _mock.Object); var connection = new SqlConnection(); _mock.Setup(s => s.Close()).Returns(connection); var c = _delegate.Close(); Assert.IsNull(c); _mock.Verify(s => s.Close(), Times.Never()); }
public ExecuteSessionCallbackUsingDelegate(SessionDelegate del) { this.del = del; }
private void DoConnect() { OTError error; _sessionDelegate = new SessionDelegate (this); _session = new OTSession(Configuration.Config.API_KEY, Configuration.Config.SESSION_ID, _sessionDelegate); _session.ConnectWithToken (Configuration.Config.TOKEN, out error); }