public void QuickVariableInputViewModel_MakeDataListReady_WhenItemsHaveSpaces_ShouldRemoveSpaces() { //------------Setup for test-------------------------- var quickVariableInputViewModel = new QuickVariableInputViewModel(new QuickVariableInputModel(ModelItemUtils.CreateModelItem(), null)); //------------Execute Test--------------------------- var makeDataListReady = quickVariableInputViewModel.MakeDataListReady(new List<string> { "Test 1", "Test 4", "T e s t" }); //------------Assert Results------------------------- Assert.AreEqual(3, makeDataListReady.Count); Assert.AreEqual("[[Test1]]", makeDataListReady[0]); Assert.AreEqual("[[Test4]]", makeDataListReady[1]); Assert.AreEqual("[[Test]]", makeDataListReady[2]); }
protected override void OnModelItemChanged(object newItem) { base.OnModelItemChanged(newItem); Context.Items.Subscribe<Selection>(SelectionChanged); _convertCollection = newItem; _activity = newItem as ModelItem; if(_convertCollection.ConvertCollection == null || _convertCollection.ConvertCollection.Count <= 0) { _convertCollection.ConvertCollection.Add(new BaseConvertTO("", "Text", "Base 64", "", 1)); _convertCollection.ConvertCollection.Add(new BaseConvertTO("", "Text", "Base 64", "", 2)); } if(_activity != null) { var modelProperty = _activity.Properties["DisplayName"]; if(modelProperty != null) { modelProperty.SetValue(CreateDisplayName()); } ModelItem parent = _activity.Parent; while(parent != null) { if(parent.Properties["Argument"] != null) { break; } parent = parent.Parent; } } ICollectionActivity modelItemActivity = ModelItem.GetCurrentValue() as ICollectionActivity; QuickVariableInputModel model = new QuickVariableInputModel(ModelItem, modelItemActivity); ViewModel = new QuickVariableInputViewModel(model); }