public async Task ContextItemsAddNewProject() { _projectSystemClient.IsSolutionOpen = true; _vm.TargetProjectLocation = null; _vm.ProjectName = null; _vm.InitializeContextItems(contextWithValueSourcesOpenProject); var expected = new ContextItemViewModel[] { new ContextItemViewModel() { Name = "is_new_item", Selector = Selectors.String, Val = "n" }, new ContextItemViewModel() { Name = "is_new_project", Selector = Selectors.String, Val = "y" }, new ContextItemViewModel() { Name = "is_from_project_wizard", Selector = Selectors.String, Val = "n" }, new ContextItemViewModel() { Name = "project_name", Selector = Selectors.String, Val = "", Visible = false }, }; CollectionAssert.AreEqual(expected, _vm.ContextItems, new ContextItemViewModelComparer()); Assert.AreEqual(PostCreateAction.AddToSolution, _vm.PostCreate); Assert.IsTrue(_vm.HasPostCommands); Assert.IsFalse(_vm.AddingToExistingProject); }
public async Task ContextItemsAddNewItem() { _projectSystemClient.IsSolutionOpen = true; _vm.TargetProjectLocation = new ProjectLocation() { ProjectUniqueName = "TestProject", ProjectKind = "{EB4B2D97-897B-4A9B-926F-38D7FAAAF399}", FolderPath = "C:\\TestProject", }; _vm.ProjectName = null; _vm.InitializeContextItems(contextWithValueSourcesOpenProject); var expected = new ContextItemViewModel[] { new ContextItemViewModel() { Name = "is_new_item", Selector = Selectors.String, Val = "y" }, new ContextItemViewModel() { Name = "is_new_project", Selector = Selectors.String, Val = "n" }, new ContextItemViewModel() { Name = "is_from_project_wizard", Selector = Selectors.String, Val = "n" }, new ContextItemViewModel() { Name = "project_name", Selector = Selectors.String, Val = "", Visible = false }, }; CollectionAssert.AreEqual(expected, _vm.ContextItems, new ContextItemViewModelComparer()); Assert.AreEqual(PostCreateAction.AddToProject, _vm.PostCreate); Assert.IsTrue(_vm.HasPostCommands); Assert.IsTrue(_vm.AddingToExistingProject); }
private void RecursiveCreateNamingServiceTree(PortType type, TreeViewItemViewModel tree, IEnumerable<string> names) { Debug.Assert(names != null, "names != null"); if (names.Count() == 1) { var item = new ComponentItemViewModel() { Name = names.First(), Parent = tree }; var compName = GetComponentName(item); ObservableCollection<PortService> portNames; switch (type) { case PortType.DataInPort: portNames = GetInPorts(compName); break; case PortType.DataOutPort: portNames = GetOutPorts(compName); break; default: return; } foreach (var portName in portNames) { var prof = portName.get_port_profile(); switch (type) { case PortType.DataInPort: var inport = new InPortItemViewModel() { Name = prof.name, NamingName = GetNamingName(item), DataType = prof.GetDataType(), Parent = item }; item.Children.Add(inport); break; case PortType.DataOutPort: var outport = new OutPortItemViewModel() { Name = prof.name, NamingName = GetNamingName(item), DataType = prof.GetDataType(), Parent = item }; item.Children.Add(outport); break; default: return; } } tree.Children.Add(item); } else { var item = new ContextItemViewModel() { Name = names.First(), Parent = tree }; tree.Children.Add(item); RecursiveCreateNamingServiceTree(type, item, names.Skip(1)); } }
private void RecursiveCreateNamingServiceTree(PortType type, TreeViewItemViewModel tree, IEnumerable <string> names) { Debug.Assert(names != null, "names != null"); if (names.Count() == 1) { var item = new ComponentItemViewModel() { Name = names.First(), Parent = tree }; var compName = GetComponentName(item); ObservableCollection <PortService> portNames; switch (type) { case PortType.DataInPort: portNames = GetInPorts(compName); break; case PortType.DataOutPort: portNames = GetOutPorts(compName); break; default: return; } foreach (var portName in portNames) { var prof = portName.get_port_profile(); switch (type) { case PortType.DataInPort: var inport = new InPortItemViewModel() { Name = prof.name, NamingName = GetNamingName(item), DataType = prof.GetDataType(), Parent = item }; item.Children.Add(inport); break; case PortType.DataOutPort: var outport = new OutPortItemViewModel() { Name = prof.name, NamingName = GetNamingName(item), DataType = prof.GetDataType(), Parent = item }; item.Children.Add(outport); break; default: return; } } tree.Children.Add(item); } else { var item = new ContextItemViewModel() { Name = names.First(), Parent = tree }; tree.Children.Add(item); RecursiveCreateNamingServiceTree(type, item, names.Skip(1)); } }