protected override void Arrange() { base.Arrange(); var section = new MockSectionWithUnnamedCollection(); this.ViewModel = SectionViewModel.CreateSection(Container, "mockSection", section); }
protected override void Arrange() { base.Arrange(); var section = new MockSectionWithSingleChild(); this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section); }
protected override void Arrange() { base.Arrange(); sectionViewModel = SectionViewModel.CreateSection(Container, "mocksection", new MockSectionWithUnnamedCollection()); toggleSectionExpandedCommand = sectionViewModel.Commands.OfType<ToggleExpandedCommand>().First(); }
protected override void Arrange() { base.Arrange(); var resources = new ResourceHelper<ConfigFileLocator>(); resources.DumpResourceFileToDisk("empty.config"); var applicationViewModel = Container.Resolve<ApplicationViewModel>(); ConfigurationSourceModel sourceModel = applicationViewModel.CurrentConfigurationSource; applicationViewModel.NewEnvironment(); EhabModel = sourceModel.AddSection(ExceptionHandlingSettings.SectionName, Section); EnvironmentViewModel = applicationViewModel.Environments.First(); EnvironmentSection = (EnvironmentalOverridesSection)EnvironmentViewModel.ConfigurationElement; ((EnvironmentSourceViewModel)EnvironmentViewModel).EnvironmentConfigurationFile = "empty.config"; ((EnvironmentSourceViewModel)EnvironmentViewModel).EnvironmentDeltaFile = "empty.config"; WrapHandler = EhabModel.DescendentElements().Where(x => x.ConfigurationType == typeof(WrapHandlerData)).First(); MainExceptionMessage = WrapHandler.Property("ExceptionMessage"); MainExceptionMessage.Value = "Main Value"; OverridesProperty = WrapHandler.Properties.Where(x => x.PropertyName.StartsWith("Overrides")).First(); OverriddenExceptionMessage = OverridesProperty.ChildProperties.Where(x => x.PropertyName == "ExceptionMessage").First(); }
protected override void Act() { var configSourceModel = Container.Resolve<ConfigurationSourceModel>(); configSourceModel.Load(source); sectionViewModel = configSourceModel.Sections.OfType<SectionViewModelEx>().First(); }
public ActionResult Edit(SectionViewModel viewmodel) { IList<Section> list = new List<Section>(); Section section = null; string[] arrSection = Request.Params["SectionName"].Split(','); string[] arrSectionId = Request.Params["SectionId"].Split(','); for (int i = 0; i < arrSection.Length; i++) { section = new Section(); section.EzineId = viewmodel.EzineId; section.Id = viewmodel.SectionId; section.Id = int.Parse(arrSectionId[i]); section.Name = arrSection[i].ToString(); list.Add(section); } var result = sectionRepository.EditSection(list); if (result) { return RedirectToAction("Index", "Ezine"); } else { return View(); } }
protected override void Act() { var section = new MockSectionWithSingleChild(); section.Children.Add(new TestHandlerDataWithChildren()); this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section); }
protected override void Arrange() { base.Arrange(); var builder = new ConfigurationSourceBuilder(); builder.ConfigureLogging() .LogToCategoryNamed("General") .SendTo.EventLog("Event Log Listener") .FormatWith(new FormatterBuilder().TextFormatterNamed("Text Formatter")) .ToLog("Application"); builder.ConfigureExceptionHandling() .GivenPolicyWithName("AllExceptions") .ForExceptionType<Exception>() .LogToCategory("General") .ThenDoNothing() .GivenPolicyWithName("OtherExceptions") .ForExceptionType<ArgumentNullException>() .LogToCategory("InvalidCategoryName") .ThenDoNothing(); var configuration = new DictionaryConfigurationSource(); builder.UpdateConfigurationWithReplace(configuration); LoggingSection = GetSection(LoggingSettings.SectionName, configuration); ExceptionHandlingSection = GetSection(ExceptionHandlingSettings.SectionName, configuration); }
protected override void Arrange() { base.Arrange(); sectionViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.Section); this.Container.RegisterInstance(new Mock<IAssemblyDiscoveryService>().Object); }
protected override void Arrange() { base.Arrange(); var section = new ValidationSettings() { Types = { new ValidatedTypeReference(typeof (given_string_length_validator_with_lower_greater_than_upper)) { Rulesets = { new ValidationRulesetData("ruleSet") { Validators = { new AndCompositeValidatorData("AndComposite1") { Validators = { new StringLengthValidatorData() { LowerBound = 10, UpperBound = 0, LowerBoundType = Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Inclusive} } } } } } } } }; ValidationViewModel = SectionViewModel.CreateSection(Container, ValidationSettings.SectionName, section); Container.Resolve<ElementLookup>().AddSection(ValidationViewModel); }
protected override void Arrange() { base.Arrange(); SectionWithDifferentCommands section = new SectionWithDifferentCommands(); Viewmodel = SectionViewModel.CreateSection(Container, "SectionWithDifferentCommands", section); }
public void NotifyPropertyChangedTests() { var vm = new SectionViewModel(); vm.Init(new DetailsViewModel()); TestsHelper.TestPublicPropertiesGetSet(vm); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.IsVisible); }
protected override void Arrange() { base.Arrange(); ConfigurationSourceBuilder sourceBuilder = new ConfigurationSourceBuilder(); sourceBuilder .ConfigureLogging() .WithOptions .FilterCustom<MockLogFilter>("filter") .LogToCategoryNamed("General") .SendTo .SystemDiagnosticsListener("listener") .SendTo .Msmq("msmqlistener") .LogToCategoryNamed("Other") .SendTo .EventLog("eventlog"); ; DesignDictionaryConfigurationSource source = new DesignDictionaryConfigurationSource(); sourceBuilder.UpdateConfigurationWithReplace(source); var sourceModel = Container.Resolve<ConfigurationSourceModel>(); sourceModel.Load(source); LoggingSectionViewModel = sourceModel.Sections.Where(x => x.SectionName == LoggingSettings.SectionName).First(); }
protected override void Arrange() { base.Arrange(); Viewmodel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, Section); Handler = (CollectionElementViewModel) Viewmodel.DescendentElements(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType)).First(); }
public SectionView(SectionViewModel viewModel) { BindingContext = viewModel; InitializeComponent(); ListViewHelper.DisableItemSelectedAction(listView); }
public void then_extended_properties_are_discovered_after_properties_collection_was_accessed() { var aWrapHandler = ehabModel.DescendentElements(x => x.ConfigurationType == typeof(WrapHandlerData)).First(); var sourceModel = Container.Resolve<ConfigurationSourceModel>(); sectionWithExtendedPropertyProvider = sourceModel.AddSection("mock section", new ConfigurationSectionWithExtendedPropertyProvider()); Assert.AreEqual(2, aWrapHandler.Properties.Where(x => x.PropertyName == "Extended Property").Count()); }
protected override void Arrange() { base.Arrange(); var section = new ElementForValidation(); sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); }
protected override void Arrange() { base.Arrange(); exceptionSettingsViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, new ExceptionHandlingSettings()); var exceptionPolicyContainer = exceptionSettingsViewModel.GetDescendentsOfType <NamedElementCollection <ExceptionPolicyData> >().First(); addExceptionPolicyCommand = exceptionPolicyContainer.AddCommands.OfType <AddExceptionPolicyCommand>().First(); }
protected override void Act() { Container.RegisterInstance <IWindowsFormsEditorService>(new Mock <IWindowsFormsEditorService>().Object); Container.RegisterInstance <IUIService>(new Mock <IUIService>().Object); var sectionModel = SectionViewModel.CreateSection(Container, "mockSection", new ConfigurationElementWithComponentModelEditor()); properties = sectionModel.Properties; }
public LoggingVerifier(ConfigurationSourceModel model) { this.model = model; currentSection = model.Sections.Where(x => x.ConfigurationType == typeof(LoggingSettings)).FirstOrDefault(); Assert.IsNotNull(currentSection, "Could not locate LoggingSettings in ConfigurationSourceModel"); }
protected override void Arrange() { base.Arrange(); var lookup = Container.Resolve<ElementLookup>(); sectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, LoggingSection); sectionViewModel.Initialize(new InitializeContext()); lookup.AddSection(sectionViewModel); }
protected override void Act() { SectionWithExtendedViewModel section = new SectionWithExtendedViewModel(); var configSourceModel = Container.Resolve<ConfigurationSourceModel>(); configSourceModel.AddSection("section", section); sectionViewModel = configSourceModel.Sections.OfType<SectionViewModel>().First(); }
protected override void Act() { var configurationSourceModel = Container.Resolve<ConfigurationSourceModel>(); viewModel = configurationSourceModel.AddSection(ExceptionHandlingSettings.SectionName, Section); loggingModel = configurationSourceModel.AddSection(LoggingSettings.SectionName, LogginSettings); numberOfLogCategories = loggingModel.DescendentElements(x => x.ConfigurationType == typeof(TraceSourceData)).Count(); numberOfLogCategories -= 3; //3 special sources }
public ActionResult Create(SectionViewModel sectionvm) { if (ModelState.IsValid) { sectionRepository.Add(sectionvm.ToOrm()); return(RedirectToRoute(new { controller = "Section", Action = "Index" })); } return(View(sectionvm)); }
public ActionResult Edit(SectionViewModel section) { if (ModelState.IsValid) { sectionRepository.Update(section.ToOrm()); return(RedirectToAction("Index")); } return(View(section)); }
private void EnsureLoggingSection() { loggingSection = GetSectionOfType <LoggingSettings>(); if (loggingSection == null) { loggingSectionIsNew = true; loggingSection = SourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings()); } }
protected override void Arrange() { base.Arrange(); var section = new ElementForValidation(); sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); validationResult = new ElementValidationResult(sectionModel, "TestMessage", true); listener = new PropertyChangedListener(validationResult); }
public IActionResult Edit(long id) { var section = sectionService.GetSection(id); SectionViewModel sectionVM = new SectionViewModel(); sectionVM.Id = section.Id; sectionVM.Name = section.Name; return(View(sectionVM)); }
public void RemoveProtectionProvider(SectionViewModel section) { var overridenValue = GetOverriddenProtectionProviderElement(section); if (overridenValue != null) { environmentSection.OverriddenProtectionProviders.Remove(overridenValue); } }
public async Task <IActionResult> Delete([FromForm] SectionViewModel model) { var section = await repo.GetSectionAsync(model.Id); repo.DeleteSection(section); await repo.SaveAsync(); return(RedirectToAction("Index")); }
void DataContextChangedHandler(object sender, DependencyPropertyChangedEventArgs e) { SectionModel = (SectionViewModel)e.NewValue; if (selectionHelper != null) { selectionHelper.Attach(SectionModel); } }
protected override void Arrange() { base.Arrange(); var section = new MockSectionWithMultipleChildCollections(); BuildSection(section); ViewModel = SectionViewModel.CreateSection(Container, "name", section); }
public ActionResult Index() { SectionViewModel model = new SectionViewModel(); model = DecorateViewModel <SectionViewModel>(model); model.TimeZones = TimeZones.getDictionary(); return(View(model)); }
public void CanExecutePaperclipsCommandShowBeFalseIfPaperclipsIsNull() { var vm = new SectionViewModel(); vm.ArePaperclipsEnabled = true; vm.CanEditPaperclips = true; vm.Paperclips = null; Assert.IsFalse(vm.PaperclipCommand.CanExecute(null)); }
// GET: Section/Create public ActionResult Create(int id) { SectionViewModel Section = new SectionViewModel { BookID = id }; return(View(Section)); }
protected override void Arrange() { base.Arrange(); exceptionSettingsViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, new ExceptionHandlingSettings()); var exceptionPolicyContainer = exceptionSettingsViewModel.GetDescendentsOfType<NamedElementCollection<ExceptionPolicyData>>().First(); addExceptionPolicyCommand = exceptionPolicyContainer.AddCommands.OfType<AddExceptionPolicyCommand>().First(); }
public static Section ToOrm(this SectionViewModel sectionvm) { return(new Section { SectionId = sectionvm.Id, Description = sectionvm.Description, Name = sectionvm.Name }); }
public void CanExecutePaperclipsCommandShowBeFalseIfCannotEditPaperclips() { var vm = new SectionViewModel(); vm.ArePaperclipsEnabled = true; vm.CanEditPaperclips = false; vm.Paperclips = new List<object>(); Assert.IsFalse(vm.PaperclipCommand.CanExecute(null)); }
public void then_extended_properties_are_discovered_after_properties_collection_was_accessed() { var aWrapHandler = ehabModel.DescendentElements(x => x.ConfigurationType == typeof(WrapHandlerData)).First(); var sourceModel = Container.Resolve <ConfigurationSourceModel>(); sectionWithExtendedPropertyProvider = sourceModel.AddSection("mock section", new ConfigurationSectionWithExtendedPropertyProvider()); Assert.AreEqual(2, aWrapHandler.Properties.Where(x => x.PropertyName == "Extended Property").Count()); }
protected override void Arrange() { base.Arrange(); Mock <AssemblyLocator> assemblyLocator = new Mock <AssemblyLocator>(); assemblyLocator.Setup(x => x.Assemblies).Returns(new Assembly[] { typeof(ManageableConfigurationSourceElement).Assembly }); this.Container.RegisterType <ManageableConfigurationSourceViewModel>( new InjectionConstructor( typeof(ElementCollectionViewModel), typeof(ConfigurationElement), new InjectionParameter <AssemblyLocator>(assemblyLocator.Object))); targetFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "manageableSourcetextnp.config"); File.Create(targetFilePath).Dispose(); File.WriteAllText(targetFilePath, "<configuration/>"); var source = new DesignConfigurationSource(targetFilePath); ConfigurationSourceElement = new ManageableConfigurationSourceElement { Name = "manageable", FilePath = "file.config", ConfigurationManageabilityProviders = { new ConfigurationSectionManageabilityProviderData { Name = "provider", TypeName = typeof(object).AssemblyQualifiedName } } }; var section = new ConfigurationSourceSection { SelectedSource = "manageable", Sources = { ConfigurationSourceElement } }; source.AddLocalSection(ConfigurationSourceSection.SectionName, section); var sourceModel = this.Container.Resolve <ConfigurationSourceModel>(); sourceModel.Load(source); SectionViewModel = sourceModel.Sections.Where(x => x.ConfigurationType == typeof(ConfigurationSourceSection)).Single(); ConfigurationSourceViewModel = SectionViewModel.GetDescendentsOfType <ManageableConfigurationSourceElement>().FirstOrDefault(); ConfigurationSourceElement = (ManageableConfigurationSourceElement)ConfigurationSourceViewModel.ConfigurationElement; }
protected override void Act() { var configurationSourceModel = Container.Resolve <ConfigurationSourceModel>(); viewModel = configurationSourceModel.AddSection(ExceptionHandlingSettings.SectionName, Section); loggingModel = configurationSourceModel.AddSection(LoggingSettings.SectionName, LogginSettings); numberOfLogCategories = loggingModel.DescendentElements(x => x.ConfigurationType == typeof(TraceSourceData)).Count(); numberOfLogCategories -= 3; //3 special sources }
protected override void Arrange() { base.Arrange(); AppSettings = new AppSettingsSection(); AppSettings.Settings.Add(new KeyValueConfigurationElement("Setting1", "Value1")); AppSettings.Settings.Add(new KeyValueConfigurationElement("Setting2", "Value2")); AppSettingsView = SectionViewModel.CreateSection(Container, "appSettings", AppSettings); }
protected override void Arrange() { base.Arrange(); ConfigurationSourceModel sourceModel = Container.Resolve<ConfigurationSourceModel>(); sourceModel.New(); var loggingSection = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, base.LoggingSection); DiagnosticsTraceListner = loggingSection.GetDescendentsOfType<SystemDiagnosticsTraceListenerData>().First(); }
//Edit existing section public IActionResult Edit(int id) { SectionViewModel viewModel = _adminService.EditSectionViewModel(id); if (viewModel == null) { return(NotFound()); } return(View(_sectionTypeToView[viewModel.SectionDto.SectionTypeId], viewModel)); }
private void EnsureExceptionHandlingSection() { exceptionSettingsSection = GetSectionOfType <ExceptionHandlingSettings>(); if (exceptionSettingsSection == null) { var section = new ExceptionHandlingSettings(); exceptionSettingsSection = SourceModel.AddSection(ExceptionHandlingSettings.SectionName, section); } }
protected override void Arrange() { base.Arrange(); var section = new ConfigurationSourceSection(); section.Sources.Add(new SystemConfigurationSourceElement() { Name = "System Source" }); var configSource = Container.Resolve<ConfigurationSourceModel>(); configSourceSectionViewModel = configSource.AddSection(ConfigurationSourceSection.SectionName, section); }
protected override void Arrange() { base.Arrange(); var lookup = Container.Resolve <ElementLookup>(); sectionViewModel = SectionViewModel.CreateSection(Container, LoggingSettings.SectionName, LoggingSection); sectionViewModel.Initialize(new InitializeContext()); lookup.AddSection(sectionViewModel); }
public IActionResult Edit(SectionViewModel vm) { if (ModelState.IsValid) { var section = _mapper.Map <Section>(vm); _sectionService.EditSection(section); return(RedirectToAction("List", "Section")); } return(View(vm)); }
public static Section MapSectionViewToSection(this SectionViewModel sectionViewModel) { return(new Section { Id = sectionViewModel.Id, Name = sectionViewModel.Name, Order = sectionViewModel.Order, ParentId = sectionViewModel.ParentSection.Id, }); }
protected override void Arrange() { base.Arrange(); var section = new ConfigurationSectionWithANamedElementCollection(); var sectionViewModel = SectionViewModel.CreateSection(base.Container, "sectionName", section); CollectionViewModel = sectionViewModel.DescendentElements().OfType <ElementCollectionViewModel>().Single(); AssemblyDiscoveryServiceMock = new Mock <IAssemblyDiscoveryService>(); }
public ActionResult Enable(int id) { SectionViewModel section = SectionMapper.ToViewModel(sectionSrv.Get(id)); section.IsActive = true; sectionSrv.Edit(SectionMapper.ToEntity(section)); return(RedirectToAction("Disabled")); }
// Get disabled sections public ViewResult Disabled() { SectionViewModel model = new SectionViewModel { IsActive = false }; ViewBag.CurrentRole = UserManager.GetRoles(User.Identity.GetUserId()).FirstOrDefault(); return(View(model)); }
public ActionResult Edit(SectionViewModel model) { if (ModelState.IsValid) { var section = sectionSrv.Edit(SectionMapper.ToEntity(model)); model = SectionMapper.ToViewModel(section); } return(RedirectToAction("Edit", new { id = model.Id })); }
// GET: Administrator/Sections public ViewResult Index() { ViewBag.CurrentRole = UserManager.GetRoles(User.Identity.GetUserId()).FirstOrDefault(); SectionViewModel model = new SectionViewModel { IsActive = true }; return(View(model)); }
public ActionResult UserProfile() { SectionViewModel model = new SectionViewModel(); model = DecorateViewModel<SectionViewModel>(model); model.CourseFormat = CourseFormat.Live; model.TimeZones = TimeZones.getDictionary(); return View(model); }
public void NotifyPropertyChangedTests() { var vm = new SectionViewModel(); TestsHelper.TestPublicPropertiesGetSet(vm); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.ArePaperclipsEnabled); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.CanEditPaperclips); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.CanViewPaperclips); TestsHelper.TestPropertyWithNotifyPropertyChanged(vm, () => vm.IsVisible); }
protected override void Arrange() { base.Arrange(); exceptionHandlingViewModel = SectionViewModel.CreateSection(Container, ExceptionHandlingSettings.SectionName, base.ExceptionSettings); ElementLookup lookup = Container.Resolve<ElementLookup>(); changeScopeForHandlers = lookup.CreateChangeScope(x => typeof(ExceptionHandlerData).IsAssignableFrom(x.ConfigurationType)); changeScopeForHandlers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(changeScopeForHandlers_CollectionChanged); }
protected override void Arrange() { base.Arrange(); HostAdapter = new SingleHierarchyConfigurationUIHostAdapter(new HostAdapterConfiguration(AppDomain.CurrentDomain.BaseDirectory), null); ConfigurationSourceModel sourceModel = (ConfigurationSourceModel)HostAdapter.GetService(typeof(ConfigurationSourceModel)); sourceModel.AddSection(CacheManagerSettings.SectionName, new CacheManagerSettings {DefaultCacheManager = "Cache Manager", CacheManagers = { { new CacheManagerData { Name = "Cache Manager" } } }, BackingStores = {{ new CustomCacheStorageData("name", "custom store type") }} }); CachingViewModel = sourceModel.Sections.Single(); CacheManager = CachingViewModel.GetDescendentsOfType<CacheManagerData>().First(); }
public IConnectionVerifier WithConnectionString(string name) { currentSection = model.Sections.Where(s => s.ConfigurationType == typeof(ConnectionStringsSection)).First(); Assert.IsTrue(model != null, "ConfigurationSourceModel does not contain ConnectionStringsSection"); currentConnection = currentSection.DescendentConfigurationsOfType<ConnectionStringSettings>() .Where(x => x.Name == name).FirstOrDefault(); Assert.IsNotNull(currentConnection, string.Format("Could not locate connection {0}", name)); return this; }