public void should_add_create_configuration_based_on_type_case_for_batch()
        {
            // arrange
            var config = new NewConfiguration { Name = "testApp", SelectedType = "batch" };

            // act
            Controller.Add(config);

            // assert
            var savedConfiguration = ((ConfigurationsList)SavedObject).Configurations.First();
            Assert.That(savedConfiguration, Is.TypeOf<BatchConfiguration>());
        }
        public ActionResult Add(NewConfiguration model)
        {
            if (ModelState.IsValid)
            {
                var configuration = _configurationsFactory.CreateConfiguration(
                    model.SelectedType,
                    model.Name.SubstitutePunctuationWithDashes(),
                    model.Name);

                _settingsManager.SaveConfiguration(configuration);

                return RedirectToAction("configure", new { area = "configuration", controller = "configure", id = configuration.Id });
            }

            return View(model);
        }
        public void should_add_post_redirect_to_configure()
        {
            // arrange
            var config = new NewConfiguration { Name = "testApp", SelectedType = "xcopy" };

            // act
            var result = Controller.Add(config) as RedirectToRouteResult;

            // assert
            result.RouteValues["area"].Should().Be("configuration");
            result.RouteValues["controller"].Should().Be("configure");
            result.RouteValues["action"].Should().Be("configure");
        }
        public void should_add_post_method_create_new_configuration()
        {
            // arrange
            var config = new NewConfiguration { Name = "testApp", SelectedType = "batch" };

            // act
            Controller.Add(config);

            // assert
            var newConfiguration = SavedObject as ConfigurationsList;
            newConfiguration.Configurations.Count.Should().Be(1);
        }