Esempio n. 1
0
        public void GetNested_ParentsSingle()
        {
            var filePath    = UTHelpers.Up();
            var ds          = new DataStore(filePath);
            var apiSettings = Options.Create(new ApiSettings());

            var controller = new DynamicController(ds, apiSettings);

            var result = controller.GetNested("families", 1, "parents/1") as OkObjectResult;

            Assert.Equal("Kim", ((dynamic)result.Value).name);

            UTHelpers.Down(filePath);
        }
Esempio n. 2
0
        public void GetNested_ParentsList()
        {
            var filePath    = UTHelpers.Up();
            var ds          = new DataStore(filePath);
            var apiSettings = Options.Create(new ApiSettings());

            var controller = new DynamicController(ds, apiSettings);

            var result = controller.GetNested("families", 1, "parents") as OkObjectResult;

            Assert.Equal(2, ((IEnumerable <dynamic>)result.Value).Count());

            UTHelpers.Down(filePath);
        }
        public void GetNested_Single_BadRequest()
        {
            var filePath    = UTHelpers.Up();
            var ds          = new DataStore(filePath);
            var apiSettings = Options.Create(new ApiSettings());

            var controller = new DynamicController(ds, apiSettings);

            var result = controller.GetNested("configuration", 0, "ip");

            Assert.IsType <BadRequestResult>(result);

            UTHelpers.Down(filePath);
        }