Exemplo n.º 1
0
        public async Task DeleteConfirmedSpotlightConnectorController()
        {
            var controller = new SpotLightConnectorsController(GetInMemoryDbMetData());
            var result     = await controller.DeleteConfirmed(spotLightConnectors[1].Id);

            var viewResult = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Index", viewResult.ActionName);
        }
Exemplo n.º 2
0
        public async Task CreatePostSpotlightConnectorController()
        {
            var context    = GetInMemoryDbMetData();
            var controller = new SpotLightConnectorsController(context);

            var result = await controller.Create(spotLightConnectors[0], null);

            var viewResult = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Index", viewResult.ActionName);
        }
Exemplo n.º 3
0
        public void CreateSpotlightConnectorController()
        {
            var context    = GetInMemoryDbMetData();
            var controller = new SpotLightConnectorsController(context);

            var result = controller.Create();

            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <SpotlightViewModel>(viewResult.ViewData.Model);

            Assert.Equal(1, model.SpotLightItems[1].Id);
            Assert.Equal("ProductIndex", model.SpotLightItems[0].Title);
        }
Exemplo n.º 4
0
        public void GetSpotlightViewModelSpotlightConnectorController()
        {
            var context    = GetInMemoryDbMetData();
            var controller = new SpotLightConnectorsController(context);

            var result = controller.GetSpotlightViewModel();

            var viewResult = Assert.IsType <SpotlightViewModel>(result);
            var model      = Assert.IsAssignableFrom <SpotlightViewModel>(viewResult);

            //Tests if SpotLightConnector is 0, because this one is empty
            Assert.Equal(0, model.SpotLightConnector.Id);

            Assert.Equal(1, model.SpotLightItems[0].Id);
            Assert.Equal(2, model.SpotLightItems.Count);
        }
Exemplo n.º 5
0
        public async Task IndexSpotlightConnectorController()
        {
            var context    = GetInMemoryDbMetData();
            var controller = new SpotLightConnectorsController(context);

            var result = await controller.Index();

            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <List <SpotLightConnector> >(viewResult.ViewData.Model);

            Assert.Equal(2, model.Count);
            Assert.NotNull(viewResult);
            Assert.Equal("Index", model[0].actionName);
            Assert.Equal("Home", model[0].controllerName);

            Assert.Equal("Create", model[1].actionName);
            Assert.Equal("Products", model[1].controllerName);
        }