private IRequestHandlers CreateRequestHandlers() { var handlers = new RequestHandlers(); handlers.TryAdd(MessageMethod.Initialize, this); handlers.TryAdd(MessageMethod.GetOperationClaims, this); return(handlers); }
public void Constructor_ThrowsIfHandshakeRequestHandlerAlreadyExists() { Assert.True(_handlers.TryAdd(MessageMethod.Handshake, Mock.Of <IRequestHandler>())); var exception = Assert.Throws <ArgumentException>(() => CreateHandshake()); Assert.Equal("connection", exception.ParamName); }
public void TryAdd_ThrowsForNullHandler() { var exception = Assert.Throws <ArgumentNullException>( () => _handlers.TryAdd(MessageMethod.Handshake, handler: null)); Assert.Equal("handler", exception.ParamName); }