public void ProtocolResolvesCorrectly(string minProtocol, string maxProtocol, string clientProtocol, string expectedProtocol) { var request = new Mock<IRequest>(); var queryStrings = new NameValueCollection(); var minProtocolVersion = new Version(minProtocol); var maxProtocolVersion = new Version(maxProtocol); var protocolResolver = new ProtocolResolver(minProtocolVersion, maxProtocolVersion); queryStrings.Add("clientProtocol", clientProtocol); request.Setup(r => r.QueryString).Returns(new NameValueCollectionWrapper(queryStrings)); var version = protocolResolver.Resolve(request.Object); Assert.Equal(version, new Version(expectedProtocol)); }
public void ProtocolResolvesCorrectly(string minProtocol, string maxProtocol, string clientProtocol, string expectedProtocol) { var minProtocolVersion = new Version(minProtocol); var maxProtocolVersion = new Version(maxProtocol); var protocolResolver = new ProtocolResolver(minProtocolVersion, maxProtocolVersion); var queryStrings = new Dictionary<string, string> { { "clientProtocol", clientProtocol } }; var context = new TestContext("/negotite", queryStrings); var version = protocolResolver.Resolve(context.MockRequest.Object); Assert.Equal(version, new Version(expectedProtocol)); }