Beispiel #1
0
        public void SharePointFileUploadDesignerViewModel_SetProperties_ReturnsSuccess()
        {
            //------------Setup for test--------------------------

            var modelItem = CreateModelItem();

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

            sharepointReadFolderDesignerViewModel.Errors = new List <IActionableErrorInfo> {
                new ActionableErrorInfo()
                {
                    Message = "Please Select a SharePoint Server"
                }
            };
            sharepointReadFolderDesignerViewModel.Validate();
            var inputPath = modelItem.GetProperty <string>("LocalInputPath");
            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);
            sharepointReadFolderDesignerViewModel.UpdateHelpDescriptor("Test");

            Assert.IsNotNull(inputPath);
            Assert.IsNotNull(sharepointReadFolderDesignerViewModel.LocalInputPath);
            Assert.AreNotEqual(sourceId, Guid.Empty);
            //------------Assert Results-------------------------
        }
Beispiel #2
0
        public void SharePointFileUploadDesignerViewModel_SetPropertiesNullSource_ReturnsSuccess()
        {
            //------------Setup for test--------------------------

            var modelItem = CreateModelItem();

            modelItem.SetProperty("LocalInputPath", "TestFolder");
            //------------Execute Test---------------------------
            var sharepointReadFolderDesignerViewModel = new SharePointFileUploadDesignerViewModel(modelItem, new SynchronousAsyncWorker(), new Mock <IServer>().Object);

            sharepointReadFolderDesignerViewModel.Errors = new List <IActionableErrorInfo> {
                new ActionableErrorInfo()
                {
                    Message = "Please Select a SharePoint Server"
                }
            };
            sharepointReadFolderDesignerViewModel.Validate();
            var inputPath = modelItem.GetProperty <string>("LocalInputPath");

            modelItem.GetProperty <Guid>("SharepointServerResourceId");

            Assert.IsNotNull(inputPath);
            Assert.IsNotNull(sharepointReadFolderDesignerViewModel.LocalInputPath);
            //------------Assert Results-------------------------
        }