예제 #1
0
        public void MySql_TestActionSetSourceHasRecSet()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            mySql.ManageServiceInputViewModel = new InputViewForTest(mySql, mod);
            mySql.SourceRegion.SelectedSource = mySql.SourceRegion.Sources.First();
            mySql.ActionRegion.SelectedAction = mySql.ActionRegion.Actions.First();
            mySql.InputArea.Inputs.Add(new ServiceInput("[[a]]", "asa"));
#pragma warning disable 4014
            mySql.TestInputCommand.Execute();
            mySql.ManageServiceInputViewModel.TestCommand.Execute(null);
            mySql.ManageServiceInputViewModel.IsEnabled          = true;
            mySql.ManageServiceInputViewModel.OutputArea.Outputs = new List <IServiceOutputMapping> {
                new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c")
            };
            mySql.ManageServiceInputViewModel.OkCommand.Execute(null);
#pragma warning restore 4014

            //------------Assert Results-------------------------
            Assert.IsTrue(mySql.SourceRegion.IsEnabled);
            Assert.IsTrue(mySql.OutputsRegion.IsEnabled);
            Assert.IsTrue(mySql.InputArea.IsEnabled);
            Assert.IsTrue(mySql.ErrorRegion.IsEnabled);
            Assert.IsTrue(mySql.ManageServiceInputViewModel.InputArea.Inputs.Count == 1);
            Assert.IsTrue(mySql.ManageServiceInputViewModel.InputArea.Inputs.First().Name == "[[a]]");
            Assert.IsTrue(mySql.ManageServiceInputViewModel.InputArea.Inputs.Last().Name == "[[a]]");
        }
예제 #2
0
        public void MySql_TestActionSetSourceAndTestClickOkHasMappingsErrorFromServer()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();

            mod.HasRecError = true;
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            mySql.ManageServiceInputViewModel = new InputViewForTest(mySql, mod);
            mySql.SourceRegion.SelectedSource = mySql.SourceRegion.Sources.First();
#pragma warning disable 4014
            mySql.TestInputCommand.Execute();
            mySql.ManageServiceInputViewModel.TestCommand.Execute(null);
            mySql.ManageServiceInputViewModel.IsEnabled          = true;
            mySql.ManageServiceInputViewModel.OutputArea.Outputs = new List <IServiceOutputMapping> {
                new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c"), new ServiceOutputMapping("a", "b", "c")
            };
            mySql.ManageServiceInputViewModel.OkCommand.Execute(null);
#pragma warning restore 4014

            //------------Assert Results-------------------------
            Assert.IsTrue(mySql.ErrorRegion.IsEnabled);
            Assert.AreNotEqual(0, mySql.ManageServiceInputViewModel.Errors.Count);
        }
예제 #3
0
        public void MySql_MethodName_ClearErrors()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            //------------Execute Test---------------------------
            mySql.ClearValidationMemoWithNoFoundError();
            //------------Assert Results-------------------------
            Assert.IsNull(mySql.Errors);
            Assert.AreEqual(mySql.DesignValidationErrors.Count, 1);
        }
예제 #4
0
        public void MySql_Ctor_EmptyModelItem()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            //------------Assert Results-------------------------
            Assert.IsTrue(mySql.SourceRegion.IsEnabled);
            Assert.IsFalse(mySql.OutputsRegion.IsEnabled);
            Assert.IsFalse(mySql.InputArea.IsEnabled);
            Assert.IsTrue(mySql.ErrorRegion.IsEnabled);
        }
예제 #5
0
        public void MySql_MethodName_ValidateExpectErrors()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            mySql.Validate();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, mySql.Errors.Count);
            Assert.AreEqual(2, mySql.DesignValidationErrors.Count);
        }
예제 #6
0
        public void MySql_VerifyCommandTimeout()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            using (var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder()))
            {
                mySql.InputArea.CommandTimeout = 321;
                //------------Assert Results-------------------------
                var dbService = mySql.ToModel();
                Assert.AreEqual(321, dbService.CommandTimeout);
            }
        }
예제 #7
0
        public void MySql_TestActionSetSource()
        {
            //------------Setup for test--------------------------
            var mod = new MySqlModel();
            var act = new DsfMySqlDatabaseActivity();

            //------------Execute Test---------------------------
            var mySql = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            mySql.ManageServiceInputViewModel = new InputViewForTest(mySql, mod);
            mySql.SourceRegion.SelectedSource = mySql.SourceRegion.Sources.First();

            //------------Assert Results-------------------------
            Assert.IsTrue(mySql.SourceRegion.IsEnabled);
            Assert.IsFalse(mySql.OutputsRegion.IsEnabled);
            Assert.IsFalse(mySql.InputArea.IsEnabled);
            Assert.IsTrue(mySql.ErrorRegion.IsEnabled);
        }
예제 #8
0
        public void MySql_Refresh_ShouldLoadRefreshActions()
        {
            //------------Setup for test--------------------------
            var id        = Guid.NewGuid();
            var mod       = new MySqlModel();
            var act       = new DsfMySqlDatabaseActivity();
            var sqlServer = new MySqlDatabaseDesignerViewModel(ModelItemUtils.CreateModelItem(act), mod, new SynchronousAsyncWorker(), new ViewPropertyBuilder());

            sqlServer.ManageServiceInputViewModel = new InputViewForTest(sqlServer, mod);
            sqlServer.SourceRegion.SelectedSource = sqlServer.SourceRegion.Sources.First();
            sqlServer.ActionRegion.IsRefreshing   = false;
            //------------Execute Test---------------------------
            sqlServer.ActionRegion.RefreshActionsCommand.Execute(null);

            //------------Assert Results-------------------------
            Assert.IsTrue(sqlServer.SourceRegion.IsEnabled);
            Assert.AreEqual(1, sqlServer.ActionRegion.Actions.Count);
        }
예제 #9
0
        public void MySql_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 MySqlModel();

            mod.HasRecError = true;
            var act       = new DsfMySqlDatabaseActivity();
            var viewModel = new MySqlDatabaseDesignerViewModel(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());
        }