public void TestAddOpenSessionEvent() { ShardImpl shard = new ShardImpl(new ShardId(1), Stub <ISessionFactoryImplementor>()); //new SessionFactoryDefaultMock() try { shard.AddOpenSessionEvent(null); Assert.Fail("expected nre"); } catch (NullReferenceException nre) { // good } IOpenSessionEvent ose = Stub <IOpenSessionEvent>(); //new OpenSessionEventDefaultMock() shard.AddOpenSessionEvent(ose); Assert.IsNotNull(shard.GetOpenSessionEvents()); Assert.AreEqual(1, shard.GetOpenSessionEvents().Count); //.size() //Assert.AreSame(ose, shard.GetOpenSessionEvents().Find(0));//.get(0) // now add another and make sure it is added to the end IOpenSessionEvent anotherOse = Stub <IOpenSessionEvent>(); shard.AddOpenSessionEvent(anotherOse); Assert.IsNotNull(shard.GetOpenSessionEvents()); Assert.AreEqual(2, shard.GetOpenSessionEvents().Count); //.size() //Assert.AreSame(ose, shard.GetOpenSessionEvents().get(0)); //Assert.AreSame(anotherOse, shard.GetOpenSessionEvents().get(1)); }
/// <summary> /// Add a open Session event /// </summary> /// <param name="event">the event to add</param> public void AddOpenSessionEvent(IOpenSessionEvent @event) { throw new System.NotImplementedException(); }
/// <summary> /// Add a open Session event /// </summary> /// <param name="event">the event to add</param> public void AddOpenSessionEvent(IOpenSessionEvent @event) { Preconditions.CheckNotNull(@event); openSessionEvents.AddLast(@event); }