public void SqlServer_MethodName_ValidateExpectErrors() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new SqlServerModel(); var act = new DsfSqlServerDatabaseActivity(); //------------Execute Test--------------------------- var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); sqlServer.Validate(); //------------Assert Results------------------------- Assert.AreEqual(1, sqlServer.Errors.Count); Assert.AreEqual(2, sqlServer.DesignValidationErrors.Count); }
public void SqlServer_Ctor_EmptyModelItem() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new SqlServerModel(); var act = new DsfSqlServerDatabaseActivity(); //------------Execute Test--------------------------- var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); //------------Assert Results------------------------- Assert.IsTrue(sqlServer.SourceRegion.IsEnabled); Assert.IsFalse(sqlServer.OutputsRegion.IsEnabled); Assert.IsFalse(sqlServer.InputArea.IsEnabled); Assert.IsTrue(sqlServer.ErrorRegion.IsEnabled); }
public void SqlServer_Refresh_ShouldLoadRefreshActions() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new SqlServerModel(); var act = new DsfSqlServerDatabaseActivity(); var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); sqlServer.ManageServiceInputViewModel = new InputViewForTest(sqlServer, mod); sqlServer.SourceRegion.SelectedSource = sqlServer.SourceRegion.Sources.First(); //------------Execute Test--------------------------- sqlServer.ActionRegion.RefreshActionsCommand.Execute(null); //------------Assert Results------------------------- Assert.IsTrue(sqlServer.SourceRegion.IsEnabled); Assert.AreEqual(1, sqlServer.ActionRegion.Actions.Count); }
public void SqlServer_TestActionSetSource() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new SqlServerModel(); var act = new DsfSqlServerDatabaseActivity(); //------------Execute Test--------------------------- var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); sqlServer.ManageServiceInputViewModel = new InputViewForTest(sqlServer, mod); sqlServer.SourceRegion.SelectedSource = sqlServer.SourceRegion.Sources.First(); //------------Assert Results------------------------- Assert.IsTrue(sqlServer.SourceRegion.IsEnabled); Assert.IsFalse(sqlServer.OutputsRegion.IsEnabled); Assert.IsFalse(sqlServer.InputArea.IsEnabled); Assert.IsTrue(sqlServer.ErrorRegion.IsEnabled); }
public void SqlServer_UpdateHelp_ShouldCallToHelpViewMode() { //------------Setup for test-------------------------- var mockMainViewModel = new Mock <IShellViewModel>(); var mockHelpViewModel = new Mock <IHelpWindowViewModel>(); mockHelpViewModel.Setup(model => model.UpdateHelpText(It.IsAny <string>())).Verifiable(); mockMainViewModel.Setup(model => model.HelpViewModel).Returns(mockHelpViewModel.Object); CustomContainer.Register(mockMainViewModel.Object); var mod = new SqlServerModel(); mod.HasRecError = true; var act = new DsfSqlServerDatabaseActivity(); var viewModel = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); //------------Execute Test--------------------------- viewModel.UpdateHelpDescriptor("help"); //------------Assert Results------------------------- mockHelpViewModel.Verify(model => model.UpdateHelpText(It.IsAny <string>()), Times.Once()); }
public void SqlServer_TestActionSetSourceAndTestClickOkHasMappings() { //------------Setup for test-------------------------- var id = Guid.NewGuid(); var mod = new SqlServerModel(); var act = new DsfSqlServerDatabaseActivity(); //------------Execute Test--------------------------- var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); sqlServer.ManageServiceInputViewModel = new InputViewForTest(sqlServer, mod); sqlServer.SourceRegion.SelectedSource = sqlServer.SourceRegion.Sources.First(); #pragma warning disable 4014 sqlServer.TestInputCommand.Execute(null); sqlServer.ManageServiceInputViewModel.TestCommand.Execute(null); sqlServer.ManageServiceInputViewModel.IsEnabled = true; sqlServer.ManageServiceInputViewModel.OutputArea.Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c") }; sqlServer.ManageServiceInputViewModel.Model = new DatabaseService() { Action = new DbAction() { Inputs = new List <IServiceInput>(), Name = "bob" } }; sqlServer.ManageServiceInputViewModel.OkCommand.Execute(null); #pragma warning restore 4014 var hashCode = sqlServer.SourceRegion.SelectedSource.GetHashCode(); //------------Assert Results------------------------- Assert.IsTrue(sqlServer.SourceRegion.IsEnabled); Assert.IsTrue(sqlServer.OutputsRegion.IsEnabled); Assert.IsTrue(sqlServer.InputArea.IsEnabled); Assert.IsTrue(sqlServer.ErrorRegion.IsEnabled); Assert.IsFalse(sqlServer.ManageServiceInputViewModel.InputArea.IsEnabled); Assert.AreEqual(0, sqlServer.ManageServiceInputViewModel.Errors.Count); Assert.AreEqual("j_bravo", sqlServer.SourceRegion.SelectedSource.ToString()); Assert.AreEqual(hashCode, sqlServer.SourceRegion.SelectedSource.GetHashCode()); }