public void ManageDatabaseServiceInputViewModel_WithOneColumn_TestActionSetSourceAndTestClickOk() { //------------Setup for test-------------------------- var mod = new SqlServerModelWithOneColumnReturn(); var act = new DsfSqlServerDatabaseActivity(); var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); var inputview = new ManageDatabaseServiceInputViewModel(sqlServer, mod); inputview.Model = new DatabaseService() { Source = new DbSourceDefinition(), Action = new DbAction() { Inputs = new List <IServiceInput>(), Name = "bob" }, }; inputview.TryExecuteTest(); //------------Execute Test--------------------------- Assert.IsTrue(inputview.TestPassed); Assert.IsFalse(inputview.TestFailed); Assert.AreEqual(string.Empty, inputview.TestMessage); Assert.IsFalse(inputview.ShowTestMessage); inputview.ExecuteOk(); //------------Execute Ok--------------------------- Assert.IsTrue(sqlServer.SourceRegion.IsEnabled); Assert.IsTrue(sqlServer.InputArea.IsEnabled); Assert.IsTrue(sqlServer.OutputsRegion.IsEnabled); //------------Assert Results------------------------- Assert.AreEqual(1, sqlServer.OutputsRegion.Outputs.Count); }
public void ManageDatabaseServiceInputViewModelOkAction_Exception() { //------------Setup for test-------------------------- var mod = new SqlServerModel(); mod.HasRecError = true; var act = new DsfSqlServerDatabaseActivity(); var sqlServer = new SqlServerDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()); var inputview = new ManageDatabaseServiceInputViewModel(sqlServer, mod); sqlServer.OutputsRegion.Outputs = null; //------------Execute Test--------------------------- inputview.ExecuteOk(); //------------Assert Results------------------------- Assert.IsTrue(inputview.Errors.Count == 1); }