示例#1
0
    public void ThrowIfEndpointTemplateIsNotWellFormed(string uri)
    {
        var clientFactory = new Mock <IHttpClientFactory>();
        var client        = new HttpRemoteStoreClient <TenantInfo>(clientFactory.Object);

        Assert.Throws <ArgumentException>(() => new HttpRemoteStore <TenantInfo>(client, uri));
    }
示例#2
0
    // Basic store functionality tested in MultiTenantStoresShould.cs

    protected override IMultiTenantStore <TenantInfo> CreateTestStore()
    {
        var client        = new HttpClient(new TestHandler());
        var clientFactory = new Mock <IHttpClientFactory>();

        clientFactory.Setup(f => f.CreateClient(It.IsAny <string>())).Returns(client);
        var typedClient = new HttpRemoteStoreClient <TenantInfo>(clientFactory.Object);

        return(new HttpRemoteStore <TenantInfo>(typedClient, "http://example.com"));
    }
示例#3
0
    public void AppendTenantWithSlashToTemplateIfMissing()
    {
        var clientFactory = new Mock <IHttpClientFactory>();
        var client        = new HttpRemoteStoreClient <TenantInfo>(clientFactory.Object);
        var store         = new HttpRemoteStore <TenantInfo>(client, "http://example.com");

        var field            = store.GetType().GetField("endpointTemplate", BindingFlags.NonPublic | BindingFlags.Instance);
        var endpointTemplate = field.GetValue(store);

        Assert.Equal($"http://example.com/{HttpRemoteStore<TenantInfo>.defaultEndpointTemplateIdentifierToken}", endpointTemplate);
    }