public void Execute_ShouldAddModel_AndShouldAssignNode_WhenModelNodeIsNull()
        {
            ModelBase  model      = new RendererModel(null);
            XmlElement newElement = new XmlDocument().CreateElement("element");
            bool       addCalled  = false;

            ISaveStrategy sut = new AddSaveStrategy <ModelBase>(model, modelParam => { addCalled = true; }, newElement);

            sut.Execute();

            Assert.IsTrue(addCalled);
            Assert.AreSame(newElement, model.Node);
        }
Esempio n. 2
0
        private void ShowFilterWindow(FilterModel filterModel)
        {
            XmlElement newFilter = mConfiguration.ConfigXml.CreateElementWithAttribute("filter", "type", filterModel.Descriptor.TypeNamespace);

            IElementConfiguration configuration = new ElementConfiguration(mConfiguration, filterModel.Node, newFilter);

            ISaveStrategy saveStrategy = new AddSaveStrategy <FilterModel>(filterModel, Add, newFilter);

            Window filterWindow = new ElementWindow(configuration,
                                                    DefinitionFactory.Create(filterModel.Descriptor, configuration),
                                                    WindowSizeLocationFactory.Create(filterModel.Descriptor),
                                                    saveStrategy);

            mMessageBoxService.ShowWindow(filterWindow);
        }
Esempio n. 3
0
        private void ShowParamWindow(ParamModel paramModel)
        {
            XmlElement newParam = mConfiguration.ConfigXml.CreateElement(ParamDescriptor.Param.ElementName);

            IElementConfiguration configuration = new ElementConfiguration(mConfiguration, paramModel.Node, newParam);

            ISaveStrategy saveStrategy = new AddSaveStrategy <ParamModel>(paramModel, AddModel, newParam);

            Window paramWindow = new ElementWindow(configuration,
                                                   DefinitionFactory.Create(ParamDescriptor.Param, configuration),
                                                   WindowSizeLocationFactory.Create(ParamDescriptor.Param),
                                                   saveStrategy);

            mMessageBoxService.ShowWindow(paramWindow);
        }