public void ThrowIfContextIsNotHttpContext()
    {
        var context  = new Object();
        var strategy = new HostStrategy("__tenant__.*");

        Assert.Throws <AggregateException>(() => strategy.GetIdentifierAsync(context).Result);
    }
    [InlineData("example.com", "__tenant__", null)]                    // no match
    public async void ReturnExpectedIdentifier(string host, string template, string expected)
    {
        var httpContext = CreateHttpContextMock(host);
        var strategy    = new HostStrategy(template);

        var identifier = await strategy.GetIdentifierAsync(httpContext);

        Assert.Equal(expected, identifier);
    }
예제 #3
0
        public void AssertUrlChange(string originalUrl, string expectedCanonicalUrl)
        {
            var uriBuilder = new UriBuilder(originalUrl);

            IUrlStrategy strategy = new HostStrategy("example.net");

            strategy.Apply(uriBuilder);

            Assert.That(uriBuilder.Uri, Is.EqualTo(new Uri(expectedCanonicalUrl)));
        }