Beispiel #1
0
        public void VerifyThatUriManagerViewModelWorks()
        {
            // Create tmp file
            Directory.CreateDirectory(this.tempfile.DirectoryName);
            this.testfile.CopyTo(this.tempfile.FullName, true);

            // Create an empty UriManagerViewModel
            var configViewModel = new UriManagerViewModel();
            int initialSize     = configViewModel.UriRowList.Count;

            // Create a new UriRowViewModel from a UriConfig
            var cl1 = new UriConfig()
            {
                Alias = "Alias1", Uri = "Uri1", DalType = "Web"
            };
            var row1 = new UriRowViewModel()
            {
                UriConfig = cl1
            };

            configViewModel.UriRowList.Add(row1);
            Assert.IsNotNull(configViewModel.UriRowList);
            Assert.IsTrue(configViewModel.UriRowList[initialSize].Alias.Equals("Alias1"));
            Assert.IsTrue(configViewModel.UriRowList[initialSize].Uri.Equals("Uri1"));
            Assert.IsTrue(configViewModel.UriRowList[initialSize].DalType == CDP4Dal.Composition.DalType.Web);

            // Create a new UriRowViewModel
            var row2 = new UriRowViewModel()
            {
                Uri = "Uri2", DalType = CDP4Dal.Composition.DalType.File
            };

            configViewModel.UriRowList.Add(row2);

            // Test get Name
            Assert.IsTrue(row2.Name.Equals("Uri2"));
            row2.Alias = "Alias2";
            Assert.IsTrue(row2.Name.Equals("Alias2"));

            // Test get UriConfig from a UriRowViewModel
            var cl2 = row2.UriConfig;

            Assert.IsTrue(cl2.Alias.Equals("Alias2"));
            Assert.IsTrue(cl2.Uri.Equals("Uri2"));
            Assert.IsTrue(cl2.DalType.Equals("File"));

            // Test there are 2 existing DalTypes
            Assert.IsTrue(configViewModel.DalTypesList.Count >= 2);

            // Test removing elemnt
            configViewModel.SelectedUriRow = row1;
            configViewModel.DeleteRowCommand.Execute(null);
            configViewModel.SelectedUriRow = row2;
            configViewModel.DeleteRowCommand.Execute(null);
            Assert.IsTrue(configViewModel.UriRowList.Count == initialSize);

            // Re-Save config file.
            configViewModel.ApplyCommand.Execute(0);
            Assert.IsTrue(File.Exists(new UriConfigFileHandler().ConfigurationFilePath));
        }
Beispiel #2
0
        public void VerifyThatUriManagerViewModelCanBeConstructed()
        {
            // Create tmp file
            Directory.CreateDirectory(this.tempfile.DirectoryName);
            this.testfile.CopyTo(this.tempfile.FullName, true);

            var configViewModel = new UriManagerViewModel();

            Assert.NotNull(configViewModel);
            Assert.NotNull(configViewModel.UriRowList);

            Assert.IsTrue(configViewModel.UriRowList[0].Alias.Equals("Alias0"));
            Assert.IsTrue(configViewModel.UriRowList[0].Uri.Equals("Uri0"));
            Assert.IsTrue(configViewModel.UriRowList[0].DalType == CDP4Dal.Composition.DalType.Web);

            // Close viewmodel
            Assert.DoesNotThrow(() => configViewModel.CloseCommand.Execute(0));
        }
Beispiel #3
0
        /// <summary>
        /// The execute open uri manager request.
        /// </summary>
        private void ExecuteOpenUriManagerRequest()
        {
            var uriManager = new UriManagerViewModel();

            this.dialogNavigationService.NavigateModal(uriManager);
        }