예제 #1
0
 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);
 }
예제 #2
0
 public UserApi(IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders)
 {
     this.baseAddress = baseAddress.WithResource("user");
     this.httpFacade = httpFacade;
     this.contentSerializer = contentSerializer;
     this.baseHeaders = baseHeaders;
 }
예제 #3
0
 public ServiceFactory(IHttpAddress baseAddress, IHttpFacade httpFacade, IContentSerializer contentSerializer, HttpHeaders baseHeaders)
 {
     this.baseAddress = baseAddress;
     this.httpFacade = httpFacade;
     this.contentSerializer = contentSerializer;
     this.baseHeaders = baseHeaders;
 }
예제 #4
0
 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");
 }
예제 #5
0
 public SystemApi(
     IHttpAddress baseAddress, 
     IHttpFacade httpFacade, 
     IContentSerializer contentSerializer, 
     HttpHeaders baseHeaders)
     : base(baseAddress, httpFacade, contentSerializer, baseHeaders, "system")
 {
 }
예제 #6
0
 public UserApi(
     IHttpAddress baseAddress, 
     IHttpFacade httpFacade, 
     IContentSerializer contentSerializer, 
     HttpHeaders baseHeaders)
     : base(baseAddress, httpFacade, contentSerializer, baseHeaders, "user")
 {
 }
예제 #7
0
 public EmailApi(
     IHttpAddress baseAddress, 
     IHttpFacade httpFacade, 
     IContentSerializer contentSerializer, 
     HttpHeaders baseHeaders, 
     string serviceName)
     : base(baseAddress, httpFacade, contentSerializer, baseHeaders, serviceName)
 {
 }
예제 #8
0
        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);
        }
예제 #9
0
 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");
 }
예제 #10
0
 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");
 }
예제 #11
0
 private void SetBaseHeaders()
 {
     httpHeaders = new HttpHeaders();
     httpHeaders.AddOrUpdate(HttpHeaders.DreamFactoryApplicationHeader, "admin");
     httpHeaders.AddOrUpdate(HttpHeaders.ContentTypeHeader, ContentSerializer.ContentType);
     httpHeaders.AddOrUpdate(HttpHeaders.AcceptHeader, ContentSerializer.ContentType);
 }
예제 #12
0
        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);
            }
        }
예제 #13
0
 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);
 }