public void ComDllViewModel_UpdateWorstDesignError() { //------------Setup for test-------------------------- var mockShellViewModel = new Mock <IShellViewModel>(); mockShellViewModel.Setup(model => model.ActiveServer).Returns(new ServerForTesting(new Mock <IExplorerRepository>())); CustomContainer.Register(mockShellViewModel.Object); var ps = SetupEmptyMockSource(); //------------Execute Test--------------------------- var vm = new ComDllViewModel(CreateModelItemWithValues(), ps.Object); vm.DesignValidationErrors.Add(new ErrorInfo() { Message = "bob error", ErrorType = ErrorType.Critical }); var p = new Warewolf.Testing.PrivateObject(vm); p.Invoke("UpdateWorstError"); var inf = vm.WorstDesignError as ErrorInfo; //------------Assert Results------------------------- Assert.IsNotNull(inf); Assert.AreEqual("bob error", inf.Message); }
public void ComDllViewModel_SetDisplayName() { //------------Setup for test-------------------------- var mockShellViewModel = new Mock <IShellViewModel>(); mockShellViewModel.Setup(model => model.ActiveServer).Returns(new ServerForTesting(new Mock <IExplorerRepository>())); CustomContainer.Register(mockShellViewModel.Object); var ps = SetupEmptyMockSource(); //------------Execute Test--------------------------- var vm = new ComDllViewModel(CreateModelItemWithValues(), ps.Object); //------------Assert Results------------------------- vm.SetDisplayName("dsfbob_builer"); var p = new Warewolf.Testing.PrivateObject(vm); Assert.AreEqual(p.GetProperty("DisplayName"), "Com DLLdsfbob_builer"); }