public void doesnt_throw_exception_on_protocol_version_newer() { var context = new MessageContext { Message = new WelcomeMessage { ProtocolVersion = 2 }, SenderSession = new WampSession(null) }; Assert.DoesNotThrow(() => handler.Handle(context)); }
public void sets_sender_session_id() { var context = new MessageContext { Message = new WelcomeMessage(sessionId, 1, "NWamp/1.0"), SenderSession = new WampSession(null) }; handler.Handle(context); context.SenderSession.SessionId.Should().Be(sessionId); }
public void schedules_procedure_call_when_defined() { schedulerMock.Setup(scheduler => scheduler.Schedule(It.IsAny<ProcedureContext>())).Verifiable(); var context = new MessageContext { Procedures = new Dictionary<string, ProcedureDefinition> { { procUri, new ProcedureDefinition(procUri, null) } }, Scheduler = schedulerMock.Object, Message = new CallMessage(callId, procUri) }; handler.Handle(context); schedulerMock.Verify(scheduler => scheduler.Schedule(It.IsAny<ProcedureContext>()), Times.Once()); }
public void doesnt_schedule_procedure_doesnt_call_when_not_defined() { schedulerMock.Setup(scheduler => scheduler.Schedule(It.IsAny<ProcedureContext>())).Verifiable(); var context = new MessageContext { Procedures = new Dictionary<string, ProcedureDefinition> { }, Scheduler = schedulerMock.Object, Message = new CallMessage(callId, procUri) }; handler.Handle(context); schedulerMock.Verify(scheduler => scheduler.Schedule(It.IsAny<ProcedureContext>()), Times.Never()); }
/// <summary> /// Method called before incoming WAMP message will be handled. /// </summary> /// <param name="messageContext">Context wrapper object for incoming WAMP message</param> protected virtual void OnMessageHandling(MessageContext messageContext) { }
public void throws_exception_on_protocol_version_older() { var context = new MessageContext { Message = new WelcomeMessage { ProtocolVersion = 0 } }; Assert.Throws(typeof(ProtocolVersionException), () => handler.Handle(context)); }