コード例 #1
0
    public void ThrowIfContextIsNotHttpContext()
    {
        var context  = new Object();
        var strategy = new HostStrategy("__tenant__.*");

        Assert.Throws <AggregateException>(() => strategy.GetIdentifierAsync(context).Result);
    }
コード例 #2
0
    [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)));
        }