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)); }
// 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")); }
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); }