Exemplo n.º 1
0
        public void EndCallsWrappedSession()
        {
            // given
            var target = new SessionWrapper(wrappedSession);

            // ensure that session is not ended
            Assert.That(wrappedSession.IsSessionEnded, Is.False);

            // when
            target.End();

            // verify forwarded calls
            Assert.That(wrappedSession.IsSessionEnded, Is.True);
        }
Exemplo n.º 2
0
        public void ABeaconSendingFlushSessionsStateConfiguresAllUnconfiguredSessions()
        {
            // given
            var target = new BeaconSendingFlushSessionsState();

            var sessionOne   = new SessionWrapper(CreateValidSession("127.0.0.1"));
            var sessionTwo   = new SessionWrapper(CreateValidSession("127.0.0.2"));
            var sessionThree = new SessionWrapper(CreateValidSession("127.0.0.2"));

            // end one session to demonstrate that those which are already ended are also configured
            sessionThree.End();
            newSessions.AddRange(new[] { sessionOne, sessionTwo, sessionThree });

            // when
            target.Execute(context);

            // verify that all three sessions are configured
            Assert.That(sessionOne.IsBeaconConfigurationSet, Is.True);
            Assert.That(sessionOne.BeaconConfiguration.Multiplicity, Is.EqualTo(1));
            Assert.That(sessionTwo.IsBeaconConfigurationSet, Is.True);
            Assert.That(sessionTwo.BeaconConfiguration.Multiplicity, Is.EqualTo(1));
            Assert.That(sessionThree.IsBeaconConfigurationSet, Is.True);
            Assert.That(sessionThree.BeaconConfiguration.Multiplicity, Is.EqualTo(1));
        }