public void ShouldCreateContentSerializer()
        {
            // Arrange

            // Act
            RestContext context = new RestContext("http://base_address", "app_name", "app_api_key");

            // Assert
            context.ContentSerializer.ShouldNotBe(null);
        }
        public void ShouldCreateBaseHeaders()
        {
            // Arrange

            // Act
            RestContext context = new RestContext("http://base_address", "app_name", "app_api_key");

            // Assert
            context.BaseHeaders.ShouldNotBe(null);
        }
Esempio n. 3
0
        public void ShouldCreateBaseHeaders()
        {
            // Arrange

            // Act
            RestContext context = new RestContext(BaseAddress);

            // Assert
            context.BaseHeaders.ShouldNotBe(null);
        }
Esempio n. 4
0
        public void ShouldCreateContentSerializer()
        {
            // Arrange

            // Act
            RestContext context = new RestContext(BaseAddress);

            // Assert
            context.ContentSerializer.ShouldNotBe(null);
        }
Esempio n. 5
0
        public void ShouldCreateHttpFacade()
        {
            // Arrange

            // Act
            RestContext context = new RestContext(BaseAddress);
            
            // Assert
            context.HttpFacade.ShouldNotBe(null);
        }
        public void ShouldUseCustomContentSerializer()
        {
            // Arrange
            IContentSerializer serializer = Mock.Of<IContentSerializer>();

            // Act
            RestContext context = new RestContext("http://base_address", "app_name", "app_api_key", null, Mock.Of<IHttpFacade>(), serializer);

            // Assert
            context.ContentSerializer.ShouldBeSameAs(serializer);
        }
        public void ShouldUseCustomHttpFacade()
        {
            // Arrange
            IHttpFacade facade = Mock.Of<IHttpFacade>();

            // Act
            RestContext context = new RestContext("http://base_address", "app_name", "app_api_key", null, facade, new JsonContentSerializer());

            // Assert
            context.HttpFacade.ShouldBeSameAs(facade);
        }
Esempio n. 8
0
        public void ShouldUseCustomContentSerializer()
        {
            // Arrange
            IContentSerializer serializer = Mock.Of<IContentSerializer>();

            // Act
            RestContext context = new RestContext(BaseAddress, Mock.Of<IHttpFacade>(), serializer);

            // Assert
            context.ContentSerializer.ShouldBeSameAs(serializer);
        }
Esempio n. 9
0
        public void ShouldUseCustomHttpFacade()
        {
            // Arrange
            IHttpFacade facade = Mock.Of<IHttpFacade>();

            // Act
            RestContext context = new RestContext(BaseAddress, facade, new JsonContentSerializer());

            // Assert
            context.HttpFacade.ShouldBeSameAs(facade);
        }
Esempio n. 10
0
        /// <summary>
        /// This program runs both integration tests and demos.
        /// </summary>
        static void Main()
        {
            Console.Title = "DreamFactory REST API Demo";
            Console.WriteLine("Using DSP address: {0}", BaseAddress);

            // Add your tests/demo here
            IRunnable[] tests =
            {
                new LoginDemo(),
                new DiscoveryDemo(), 
                new UserDemo(),
                new EmailDemo(), 
                new DatabaseDemo(), 
                new FilesDemo(), 
                new SystemDemo(),
                new CustomSettingsDemo(),
                new SystemAppTest(),
                new SystemUserTest(),
                new SystemRoleTest(),
                new SystemDeviceTest(),
                new SystemScriptTest(),
                new SystemEventTest(),
                new LogoutDemo(),
                new HttpDemo()
            };

            IRestContext context = new RestContext(BaseAddress);

            Array.ForEach(tests, test =>
            {
                Console.WriteLine();
                Console.WriteLine("***** {0} ******", test.GetType().Name);
                test.RunAsync(context).Wait();
            });

            Console.ResetColor();
            Console.WriteLine();
            Console.WriteLine("Total tests: {0}.", tests.Length);
        }
 private static IRestContext CreateRestContext()
 {
     IHttpFacade httpFacade = new TestDataHttpFacade();
     IRestContext context = new RestContext("http://base_address", "app_name", "app_api_key", null, httpFacade, new JsonContentSerializer(), RestApiVersion.V1);
     return context;
 }
        public void ShouldSetSessionIdHeader2()
        {
            // Arrange
            RestContext context = new RestContext("http://base_address", "app_name", "app_api_key", "session_id");

            // Act
            Dictionary<string, object> headers = context.BaseHeaders.Build();

            // Assert
            headers[HttpHeaders.DreamFactorySessionTokenHeader].ShouldBe("session_id");
        }
Esempio n. 13
0
 private static IRestContext CreateRestContext()
 {
     IHttpFacade httpFacade = new TestDataHttpFacade();
     IRestContext context = new RestContext(BaseAddress, httpFacade, new JsonContentSerializer());
     return context;
 }