예제 #1
0
        public void SharePointMoveFileDesignerViewModel_SetPropertiesNullLocalPathTo_ReturnsSuccess()
        {
            //------------Setup for test--------------------------

            var modelItem = CreateModelItem();

            modelItem.SetProperty("ServerInputPathFrom", "TestFolder");
            modelItem.SetProperty("SharepointServerResourceId", Guid.NewGuid());
            //------------Execute Test---------------------------
            var sharepointFileMoveDesignerViewModel = new SharePointMoveFileDesignerViewModel(modelItem, new SynchronousAsyncWorker(), new Mock <IServer>().Object);

            sharepointFileMoveDesignerViewModel.Errors = new List <IActionableErrorInfo> {
                new ActionableErrorInfo()
                {
                    Message = "Please Select a SharePoint Server"
                }
            };
            sharepointFileMoveDesignerViewModel.Validate();

            var inputPathfrom = modelItem.GetProperty <string>("ServerInputPathFrom");

            Assert.IsNotNull(inputPathfrom);
            Assert.IsNotNull(sharepointFileMoveDesignerViewModel.ServerInputPathTo);
            //------------Assert Results-------------------------
        }
예제 #2
0
        public void SharePointMoveFileDesignerViewModel_Constructor_NullModelItem_ThrowsException()
        {
            //------------Setup for test--------------------------


            //------------Execute Test---------------------------
            var sharepointFileMoveDesignerViewModel = new SharePointMoveFileDesignerViewModel(CreateModelItem());

            //------------Assert Results-------------------------
            Assert.IsNull(sharepointFileMoveDesignerViewModel);
        }
예제 #3
0
        public void SharePointMoveFileDesignerViewModel_InitilizeProperties_ReturnsSuccess()
        {
            //------------Setup for test--------------------------


            //------------Execute Test---------------------------
            var sharepointFileMoveDesignerViewModel = new SharePointMoveFileDesignerViewModel(CreateModelItem(), new SynchronousAsyncWorker(), new Mock <IServer>().Object);

            sharepointFileMoveDesignerViewModel.UpdateHelpDescriptor("Test");

            Assert.IsNotNull(sharepointFileMoveDesignerViewModel);
            Assert.IsNotNull(sharepointFileMoveDesignerViewModel.CollectionName);
            //------------Assert Results-------------------------
        }
예제 #4
0
        public void SharePointMoveFileDesignerViewModel_SetProperties_ReturnsSuccess()
        {
            //------------Setup for test--------------------------

            var modelItem = CreateModelItem();

            modelItem.SetProperty("ServerInputPathFrom", "TestFolder");
            modelItem.SetProperty("ServerInputPathTo", "TestFolder");
            modelItem.SetProperty("SharepointServerResourceId", Guid.NewGuid());
            //------------Execute Test---------------------------
            var sharepointFileMoveDesignerViewModel = new SharePointMoveFileDesignerViewModel(modelItem, new SynchronousAsyncWorker(), new Mock <IServer>().Object);

            sharepointFileMoveDesignerViewModel.Errors = new List <IActionableErrorInfo> {
                new ActionableErrorInfo()
                {
                    Message = "Please Select a SharePoint Server"
                }
            };
            sharepointFileMoveDesignerViewModel.Validate();
            var inputPathfrom = modelItem.GetProperty <string>("ServerInputPathFrom");
            var inputPathTo   = modelItem.GetProperty <string>("ServerInputPathTo");
            var sourceId      = modelItem.GetProperty <Guid>("SharepointServerResourceId");


            var mockMainViewModel       = new Mock <IShellViewModel>();
            var mockHelpWindowViewModel = new Mock <IHelpWindowViewModel>();

            mockMainViewModel.Setup(model => model.HelpViewModel).Returns(mockHelpWindowViewModel.Object);
            CustomContainer.Register(mockMainViewModel.Object);
            sharepointFileMoveDesignerViewModel.UpdateHelpDescriptor("Test");

            Assert.IsNotNull(inputPathfrom);
            Assert.IsNotNull(inputPathTo);
            Assert.IsNotNull(sharepointFileMoveDesignerViewModel.ServerInputPathFrom);
            Assert.IsNotNull(sharepointFileMoveDesignerViewModel.ServerInputPathTo);
            Assert.AreNotEqual(sourceId, Guid.Empty);
            //------------Assert Results-------------------------
        }