private static ISystemApi CreateSystemApi(out HttpHeaders headers, string suffix = null) { IHttpFacade httpFacade = new TestDataHttpFacade(suffix); HttpAddress address = new HttpAddress("http://base_address", RestApiVersion.V1); headers = new HttpHeaders(); return new SystemApi(address, httpFacade, new JsonContentSerializer(), headers); }
public UserApi(IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders) { this.baseAddress = baseAddress.WithResource("user"); this.httpFacade = httpFacade; this.contentSerializer = contentSerializer; this.baseHeaders = baseHeaders; }
public ServiceFactory(IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders) { this.baseAddress = baseAddress; this.httpFacade = httpFacade; this.contentSerializer = contentSerializer; this.baseHeaders = baseHeaders; }
private static IEmailApi CreateEmailApi() { IHttpFacade httpFacade = new TestDataHttpFacade(); HttpAddress address = new HttpAddress("http://base_address", RestApiVersion.V1); HttpHeaders headers = new HttpHeaders(); return new EmailApi(address, httpFacade, new JsonContentSerializer(), headers, "email"); }
public SystemApi( IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders) : base(baseAddress, httpFacade, contentSerializer, baseHeaders, "system") { }
public UserApi( IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders) : base(baseAddress, httpFacade, contentSerializer, baseHeaders, "user") { }
public EmailApi( IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders, string serviceName) : base(baseAddress, httpFacade, contentSerializer, baseHeaders, serviceName) { }
public void ShouldCreateEmailApi() { // Arrange HttpHeaders headers = new HttpHeaders(); IServiceFactory factory = new ServiceFactory(Mock.Of<IHttpAddress>(), Mock.Of<IHttpFacade>(), Mock.Of<IContentSerializer>(), headers); // Act IEmailApi api = factory.CreateEmailApi("email"); // Assert api.ShouldNotBe(null); }
private static IFilesApi CreateFilesApi() { IHttpFacade httpFacade = new TestDataHttpFacade(); HttpAddress address = new HttpAddress(BaseAddress, RestApiVersion.V1); HttpHeaders headers = new HttpHeaders(); return new FilesApi(address, httpFacade, new JsonContentSerializer(), headers, "files"); }
private static IDatabaseApi CreateDatabaseApi(string alt = null) { IHttpFacade httpFacade = new TestDataHttpFacade(alt); HttpAddress address = new HttpAddress(BaseAddress, RestApiVersion.V1); HttpHeaders headers = new HttpHeaders(); return new DatabaseApi(address, httpFacade, new JsonContentSerializer(), headers, "db"); }
private void SetBaseHeaders() { httpHeaders = new HttpHeaders(); httpHeaders.AddOrUpdate(HttpHeaders.DreamFactoryApplicationHeader, "admin"); httpHeaders.AddOrUpdate(HttpHeaders.ContentTypeHeader, ContentSerializer.ContentType); httpHeaders.AddOrUpdate(HttpHeaders.AcceptHeader, ContentSerializer.ContentType); }
private void SetBaseHeaders(string applicationName, string applicationApiKey, string sessionId) { httpHeaders = new HttpHeaders(); httpHeaders.AddOrUpdate(HttpHeaders.FolderNameHeader, applicationName); httpHeaders.AddOrUpdate(HttpHeaders.DreamFactoryApiKeyHeader, applicationApiKey); httpHeaders.AddOrUpdate(HttpHeaders.ContentTypeHeader, ContentSerializer.ContentType); httpHeaders.AddOrUpdate(HttpHeaders.AcceptHeader, ContentSerializer.ContentType); if (!string.IsNullOrEmpty(sessionId)) { httpHeaders.AddOrUpdate(HttpHeaders.DreamFactorySessionTokenHeader, sessionId); } }
private static IUserApi CreateUserApi(out HttpHeaders headers, string suffix = null) { IHttpFacade httpFacade = new TestDataHttpFacade(suffix); HttpAddress address = new HttpAddress(BaseAddress, RestApiVersion.V1); headers = new HttpHeaders(); return new UserApi(address, httpFacade, new JsonContentSerializer(), headers); }