public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsValid_SystemInformationCollectionHasTwoItems() { var modelItem = ModelItemUtils.CreateModelItem(new DsfGatherSystemInformationActivity()); var viewModel = new GatherSystemInformationDesignerViewModel(modelItem); dynamic mi = viewModel.ModelItem; Assert.AreEqual(2, mi.SystemInformationCollection.Count); }
public void GatherSysInfoDesignerViewModel_ValidateCollectionItem_ValidatesPropertiesOfDTO() { //------------Setup for test-------------------------- var mi = ModelItemUtils.CreateModelItem(new DsfGatherSystemInformationActivity()); mi.SetProperty("DisplayName", "Sys Info"); var dto = new GatherSystemInformationTO(enTypeOfSystemInformationToGather.DateTimeFormat, "a&]]", 0, true); var miCollection = mi.Properties["SystemInformationCollection"].Collection; var dtoModelItem = miCollection.Add(dto); var viewModel = new GatherSystemInformationDesignerViewModel(mi); viewModel._getDatalistString = () => { const string trueString = "True"; const string noneString = "None"; var datalist = string.Format("<DataList><var Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><a Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><b Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><h Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><r Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><rec Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" ><set Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /></rec></DataList>", trueString, noneString); return(datalist); }; //------------Execute Test--------------------------- viewModel.Validate(); //------------Assert Results------------------------- Assert.AreEqual(2, viewModel.Errors.Count); StringAssert.Contains(viewModel.Errors[0].Message, Warewolf.Resource.Errors.ErrorResource.GatherSystemInfoInputInvalidExpressionErrorTest); Verify_IsFocused(dtoModelItem, viewModel.Errors[0].Do, "IsResultFocused"); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsValid_CollectionNameIsSetToSystemInformationCollection() { var items = new List <GatherSystemInformationTO> { new GatherSystemInformationTO() }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); Assert.AreEqual("SystemInformationCollection", viewModel.CollectionName); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsValid_ListHasFourItems() { var items = new List <GatherSystemInformationTO> { new GatherSystemInformationTO() }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); Assert.AreEqual(17, viewModel.ItemsList.Count); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsInitializedWith4Items_SystemInformationCollectionHasFourItems() { var items = new List<GatherSystemInformationTO> { new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0) }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); dynamic mi = viewModel.ModelItem; Assert.AreEqual(5, mi.SystemInformationCollection.Count); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsInitializedWith4Items_SystemInformationCollectionHasFourItems() { var items = new List <GatherSystemInformationTO> { new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0), new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, "None", 0) }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); dynamic mi = viewModel.ModelItem; Assert.AreEqual(5, mi.SystemInformationCollection.Count); }
public void GatherSystemInformationDesignerViewModel_UpdateHelp_ShouldCallToHelpViewMode() { //------------Setup for test-------------------------- var mockMainViewModel = new Mock <IShellViewModel>(); var mockHelpViewModel = new Mock <IHelpWindowViewModel>(); mockHelpViewModel.Setup(model => model.UpdateHelpText(It.IsAny <string>())).Verifiable(); mockMainViewModel.Setup(model => model.HelpViewModel).Returns(mockHelpViewModel.Object); CustomContainer.Register(mockMainViewModel.Object); var items = new List <GatherSystemInformationTO> { new GatherSystemInformationTO() }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); //------------Execute Test--------------------------- viewModel.UpdateHelpDescriptor("help"); //------------Assert Results------------------------- mockHelpViewModel.Verify(model => model.UpdateHelpText(It.IsAny <string>()), Times.Once()); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsValid_CollectionNameIsSetToSystemInformationCollection() { var items = new List<GatherSystemInformationTO> { new GatherSystemInformationTO() }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); Assert.AreEqual("SystemInformationCollection", viewModel.CollectionName); }
public void GatherSystemInformationDesignerViewModel_Constructor_ModelItemIsValid_ListHasFourItems() { var items = new List<GatherSystemInformationTO> { new GatherSystemInformationTO() }; var viewModel = new GatherSystemInformationDesignerViewModel(CreateModelItem(items)); Assert.AreEqual(17, viewModel.ItemsList.Count); }