public void SchemaSource_httpPost_when_model_schemadefinitionfromurl_is_null_returns_redirect_to_action_Create()
        {
            //arrange
            var nameValueCollection = new NameValueCollection()
            {
            };

            nameValueCollection.Add("useUrl", "yes");
            var mockRequestBase = new Mock <HttpRequestBase>();

            //mockRequestBase.Setup(x => x.Params).Returns(nameValueCollection);
            mockRequestBase.SetReturnsDefault(nameValueCollection);
            _mockHttpContextBase.SetupGet(x => x.Request).Returns(mockRequestBase.Object);


            var controller = new SchemaController(_esdFunctionService, _dataShareSchemaImportService, _datasetSchemaService,
                                                  _dataSetSchemaColumnService, _categoryService, _systemConfigurationService);

            controller.ControllerContext = new ControllerContext(_mockHttpContextBase.Object, new RouteData(), controller);
            var model = new SchemaSourceViewModel()
            {
                SchemaDefinitionFromUrl = null
            };
            //act
            var result = (RedirectToRouteResult)controller.SchemaSource(model, "categoryname");

            //assert
            Assert.AreEqual("Create", result.RouteValues["action"]);
            //cleanup
        }
        public void SchemaSource_returns_defaultview()
        {
            //arrange
            var controller = new SchemaController(_esdFunctionService, _dataShareSchemaImportService, _datasetSchemaService,
                                                  _dataSetSchemaColumnService, _categoryService, _systemConfigurationService);
            //act
            var result = (ViewResult)controller.SchemaSource("categoryname");

            //assert
            Assert.AreEqual("", result.ViewName);
            //cleanup
        }
        public void SchemaSource_httpPost_when_request_use_url_not_yes_returns_redirect_to_action_Create()
        {
            //arrange
            var nameValueCollection = new NameValueCollection();

            nameValueCollection.Add("useUrl", "notyest");
            _mockRequestBase.Setup(x => x.Params).Returns(nameValueCollection);
            _mockHttpContextBase.SetupGet(x => x.Request).Returns(_mockRequestBase.Object);
            _mockHttpContextBase.SetupGet(x => x.Response).Returns(_mockResponseBase.Object);


            var controller = new SchemaController(_esdFunctionService, _dataShareSchemaImportService, _datasetSchemaService,
                                                  _dataSetSchemaColumnService, _categoryService, _systemConfigurationService);

            controller.ControllerContext = new ControllerContext(_mockHttpContextBase.Object, new RouteData(), controller);
            var model = new SchemaSourceViewModel();
            //act
            var result = (RedirectToRouteResult)controller.SchemaSource(model, "categoryname");

            //assert
            Assert.AreEqual("Create", result.RouteValues["action"]);
            //cleanup
        }