public void Oracle_MethodName_ClearErrors() { //------------Setup for test-------------------------- CustomContainer.LoadedTypes = new List <Type>() { typeof(ManageDbServiceModel) }; 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); var server = new Mock <IServer>(); var updatemanager = new Mock <IStudioUpdateManager>(); var queryManager = new Mock <IQueryManager>(); queryManager.Setup(manager => manager.FetchDbSources()).Returns(new List <IDbSource>()); server.Setup(server1 => server1.UpdateRepository).Returns(updatemanager.Object); server.Setup(server1 => server1.QueryProxy).Returns(queryManager.Object); mockMainViewModel.Setup(model => model.ActiveServer).Returns(server.Object); CustomContainer.Register(mockMainViewModel.Object); var mod = new OracleModel(); var act = new DsfOracleDatabaseActivity(); var oracle = new OracleDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), new SynchronousAsyncWorker(), new ViewPropertyBuilder()); //------------Execute Test--------------------------- oracle.ClearValidationMemoWithNoFoundError(); //------------Assert Results------------------------- Assert.IsNull(oracle.Errors); Assert.AreEqual(oracle.DesignValidationErrors.Count, 1); }
public void Oracle_TestActionSetSourceAndTestClickOkHasMappings() { //------------Setup for test-------------------------- CustomContainer.LoadedTypes = new List <Type>() { typeof(ManageDbServiceModel) }; 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); var server = new Mock <IServer>(); var updatemanager = new Mock <IStudioUpdateManager>(); var queryManager = new Mock <IQueryManager>(); queryManager.Setup(manager => manager.FetchDbSources()).Returns(new List <IDbSource>()); server.Setup(server1 => server1.UpdateRepository).Returns(updatemanager.Object); server.Setup(server1 => server1.QueryProxy).Returns(queryManager.Object); mockMainViewModel.Setup(model => model.ActiveServer).Returns(server.Object); CustomContainer.Register(mockMainViewModel.Object); var mod = new OracleModel(); var act = new DsfOracleDatabaseActivity(); //------------Execute Test--------------------------- var oracle = new OracleDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), new SynchronousAsyncWorker(), new ViewPropertyBuilder()); oracle.ManageServiceInputViewModel = new InputViewForTest(oracle, mod); oracle.SourceRegion.SelectedSource = mod.Sources.First(); #pragma warning disable 4014 oracle.TestInputCommand.Execute(null); oracle.ManageServiceInputViewModel.TestCommand.Execute(null); oracle.ManageServiceInputViewModel.IsEnabled = true; oracle.ManageServiceInputViewModel.OutputArea.Outputs = new List <IServiceOutputMapping> { new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c") }; oracle.ManageServiceInputViewModel.Model = new DatabaseService() { Action = new DbAction() { Inputs = new List <IServiceInput>(), Name = "bob" } }; oracle.ManageServiceInputViewModel.OkCommand.Execute(null); #pragma warning restore 4014 //------------Assert Results------------------------- Assert.IsTrue(oracle.SourceRegion.IsEnabled); Assert.IsTrue(oracle.OutputsRegion.IsEnabled); Assert.IsTrue(oracle.InputArea.IsEnabled); Assert.IsTrue(oracle.ErrorRegion.IsEnabled); Assert.IsFalse(oracle.ManageServiceInputViewModel.InputArea.IsEnabled); Assert.AreEqual(0, oracle.ManageServiceInputViewModel.Errors.Count); }
public void Oracle_VerifyCommandTimeout() { //------------Setup for test-------------------------- var mod = new OracleModel(); var act = new DsfOracleDatabaseActivity(); //------------Execute Test--------------------------- using (var vm = new OracleDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder())) { vm.InputArea.CommandTimeout = 321; //------------Assert Results------------------------- var dbService = vm.ToModel(); Assert.AreEqual(321, dbService.CommandTimeout); } }
public void Oracle_TestActionSetSource() { //------------Setup for test-------------------------- CustomContainer.LoadedTypes = new List <Type>() { typeof(ManageDbServiceModel) }; 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); var server = new Mock <IServer>(); var updatemanager = new Mock <IStudioUpdateManager>(); var queryManager = new Mock <IQueryManager>(); queryManager.Setup(manager => manager.FetchDbSources()).Returns(new List <IDbSource>()); server.Setup(server1 => server1.UpdateRepository).Returns(updatemanager.Object); server.Setup(server1 => server1.QueryProxy).Returns(queryManager.Object); mockMainViewModel.Setup(model => model.ActiveServer).Returns(server.Object); CustomContainer.Register(mockMainViewModel.Object); var mod = new OracleModel(); var act = new DsfOracleDatabaseActivity(); //------------Execute Test--------------------------- var oracle = new OracleDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), new SynchronousAsyncWorker(), new ViewPropertyBuilder()); oracle.ManageServiceInputViewModel = new InputViewForTest(oracle, mod); oracle.SourceRegion.SelectedSource = mod.Sources.First(); //------------Assert Results------------------------- Assert.IsTrue(oracle.SourceRegion.IsEnabled); Assert.IsFalse(oracle.OutputsRegion.IsEnabled); Assert.IsFalse(oracle.InputArea.IsEnabled); Assert.IsTrue(oracle.ErrorRegion.IsEnabled); }
public void Oracle_UpdateHelp_ShouldCallToHelpViewMode() { //------------Setup for test-------------------------- CustomContainer.LoadedTypes = new List <Type>() { typeof(ManageDbServiceModel) }; 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); var server = new Mock <IServer>(); var updatemanager = new Mock <IStudioUpdateManager>(); var queryManager = new Mock <IQueryManager>(); queryManager.Setup(manager => manager.FetchDbSources()).Returns(new List <IDbSource>()); server.Setup(server1 => server1.UpdateRepository).Returns(updatemanager.Object); server.Setup(server1 => server1.QueryProxy).Returns(queryManager.Object); mockMainViewModel.Setup(model => model.ActiveServer).Returns(server.Object); CustomContainer.Register(mockMainViewModel.Object); var mod = new OracleModel(); mod.HasRecError = true; var act = new DsfOracleDatabaseActivity(); var oracle = new OracleDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), new SynchronousAsyncWorker(), new ViewPropertyBuilder()); //------------Execute Test--------------------------- oracle.UpdateHelpDescriptor("help"); //------------Assert Results------------------------- mockHelpViewModel.Verify(model => model.UpdateHelpText(It.IsAny <string>()), Times.Once()); }