Example #1
0
        public void ShouldDoNothingWhenTryingToAddTableWhenNoNodeIsSelected()
        {
            var viewModel = new ProjectViewModel(dataService);
            ProjectViewModelCommandHandler commandHandler = new ProjectViewModelCommandHandler(viewModel);

            var tableToAdd = viewModel.Model.Tables.First();

            commandHandler.AddTableToNode(tableToAdd);
        }
Example #2
0
        public void ShouldAddTableToNode()
        {
            var viewModel = new ProjectViewModel(dataService);
            ProjectViewModelCommandHandler commandHandler = new ProjectViewModelCommandHandler(viewModel);
            var tableToAdd = new TableEntity("dbo", "Countries");

            commandHandler.AddTableToNode(tableToAdd);

            Assert.That(viewModel.SelectedExecutionNode.Tables.Where(x => x.FullName.Equals(tableToAdd.FullName)).Count(), Is.EqualTo(1), "Added table should be in collection");
            Assert.That(viewModel.SelectedExecutionNode.Tables.Contains(tableToAdd), Is.False, "Added table should not be the same table, it should be cloned and be a new entity");
        }