예제 #1
0
        public void StudioServerProxy_Rollback_GivenVersionIdAndResourceId_ShouldLoadVersionIdAndResourceId()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();
            var mock = new Mock <IRollbackResult>();

            mockVersionManager.Setup(manager => manager.RollbackTo(It.IsAny <Guid>(), It.IsAny <string>()))
            .Returns(mock.Object)
            .Verifiable();
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.MoveItem(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(ValueFunction(ExecStatus.Fail));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            var item = studioServerProxy.Rollback(It.IsAny <Guid>(), It.IsAny <string>());

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);

            mockVersionManager.Verify(manager => manager.RollbackTo(It.IsAny <Guid>(), It.IsAny <string>()));
        }
예제 #2
0
        public void StudioServerProxy_Delete_WhenVersion_ShouldDeleteVersion()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            mockQueryManager.Setup(manager => manager.FetchDependants(It.IsAny <Guid>())).Returns(new ExecuteMessage());
            mockVersionManager.Setup(manager => manager.DeleteVersion(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>())).Verifiable();
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;

            var mockExplorerItemModelParent = new Mock <IExplorerItemViewModel>();

            mockExplorerItemModelParent.Setup(model => model.ResourceType).Returns("Folder");
            mockExplorerItemModelParent.Setup(model => model.ResourcePath).Returns("folderPath");

            var mockExplorerItemModel = new Mock <IExplorerItemViewModel>();

            mockExplorerItemModel.Setup(model => model.ResourceType).Returns("Version");
            mockExplorerItemModel.Setup(model => model.Parent).Returns(mockExplorerItemModelParent.Object);
            var mockPopupController = new Mock <IPopupController>();

            mockPopupController.Setup(controller => controller.Show(It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.OK, MessageBoxImage.Error, "false", true, true, false, false, false, false)).Returns(MessageBoxResult.OK);
            CustomContainer.Register(mockPopupController.Object);
            //------------Execute Test---------------------------
            var item = studioServerProxy.TryDelete(mockExplorerItemModel.Object);

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);
            mockVersionManager.Verify(manager => manager.DeleteVersion(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            mockQueryManager.Verify(manager => manager.FetchDependants(It.IsAny <Guid>()), Times.Never);
            Assert.IsTrue(item.IsDeleted);
        }
예제 #3
0
        public void StudioServerProxy_Move_WhenFaulty_ShouldReturnfalse()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            mockQueryManager.Setup(manager => manager.FetchDependants(It.IsAny <Guid>())).Returns(new ExecuteMessage());
            mockVersionManager.Setup(manager => manager.DeleteVersion(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>())).Verifiable();
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.MoveItem(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(ValueFunction(ExecStatus.Fail));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            var mockExplorerItemModel = new Mock <IExplorerItemViewModel>();

            mockExplorerItemModel.SetupAllProperties();
            mockExplorerItemModel.Setup(model => model.ResourceType).Returns("Resource");
            var mockPopupController = new Mock <IPopupController>();

            mockPopupController.Setup(controller => controller.Show(It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.OK, MessageBoxImage.Error, "false", true, true, false, false, false, false)).Returns(MessageBoxResult.OK);
            CustomContainer.Register(mockPopupController.Object);
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            var item = studioServerProxy.Move(mockExplorerItemModel.Object, treeItem.Object);

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);
            Assert.IsFalse(item.Result);
            updateManagerProxy.Verify(manager => manager.MoveItem(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>()));
        }
예제 #4
0
        public void StudioServerProxy_CreateFolder_VerifyFolderIsTrue()
        {
            //------------Setup for test--------------------------
            var commControllerFatoryMock = new Mock <ICommunicationControllerFactory>();
            var commController           = new Mock <ICommunicationController>();

            commController.Setup(controller => controller.ExecuteCommand <IExplorerRepositoryResult>(It.IsAny <IEnvironmentConnection>(), It.IsAny <Guid>())).Returns(new ExplorerRepositoryResult(ExecStatus.Success, ""));
            ServerExplorerItem sendItem = null;
            var serialiser = new Dev2JsonSerializer();

            commController.Setup(controller => controller.AddPayloadArgument(It.IsAny <string>(), It.IsAny <StringBuilder>())).Callback((string key, StringBuilder builder) => {
                sendItem = serialiser.Deserialize <ServerExplorerItem>(builder);
            });
            commControllerFatoryMock.Setup(controller => controller.CreateController(It.IsAny <string>())).Returns(commController.Object);
            var studioServerProxy  = new StudioServerProxy(commControllerFatoryMock.Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;

            var resID   = Guid.NewGuid();
            var resName = "TestFolder";
            var resPath = "TestFolderPath";

            //------------Execute Test---------------------------
            studioServerProxy.CreateFolder(resPath, resName, resID);
            //------------Assert Results-------------------------
            Assert.AreEqual(resID, sendItem.ResourceId);
            Assert.AreEqual(resName, sendItem.DisplayName);
            Assert.AreEqual(resPath + "\\" + resName, sendItem.ResourcePath);
            Assert.AreEqual("Folder", sendItem.ResourceType);
            Assert.AreEqual(true, sendItem.IsFolder);
        }
예제 #5
0
        public void StudioServerProxy_HasDependencies_GivenNodesAndDeleteAnyway_ShowDepenciesIsFalse()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mock1             = new Mock <IPopupController>();

            mock1.Setup(controller => controller.DeleteAnyway).Returns(true);
            CustomContainer.Register(mock1.Object);
            var mock = new Mock <IExplorerItemViewModel>();
            var dependencyGraphGenerator = new Mock <IDependencyGraphGenerator>();
            var value = new Graph("myGraph");

            value.Nodes.Add(new DependencyVisualizationNode("a", 2, 2, false, false));
            value.Nodes.Add(new DependencyVisualizationNode("b", 2, 2, false, false));
            dependencyGraphGenerator.Setup(generator => generator.BuildGraph(It.IsAny <StringBuilder>(), It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>()))
            .Returns(value);
            var msgMock = new Mock <IExecuteMessage>();
            //------------Execute Test---------------------------
            var metaData = studioServerProxy.HasDependencies(mock.Object, dependencyGraphGenerator.Object, msgMock.Object, mock1.Object);

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(metaData, typeof(IDeletedFileMetadata));
            var deletedFileMetadata = metaData;

            Assert.IsNotNull(deletedFileMetadata);
            Assert.AreEqual(false, deletedFileMetadata.IsDeleted);
            Assert.AreEqual(false, deletedFileMetadata.ShowDependencies);
            Assert.AreEqual(mock1.Object.ApplyToAll, deletedFileMetadata.ApplyToAll);
            Assert.AreEqual(mock1.Object.DeleteAnyway, deletedFileMetadata.DeleteAnyway);
            Assert.AreEqual(mock.Object.ResourceId, deletedFileMetadata.ResourceId);
        }
예제 #6
0
        public void StudioServerProxy_GetVersions_WhenGivenVersionId_ShouldLoadUsingVersionId()
        {
            //------------Setup for test--------------------------
            var mockEnvironmentConnection = new Mock <IEnvironmentConnection>();

            mockEnvironmentConnection.Setup(o => o.IsConnected).Returns(true);

            var resourceId = Guid.NewGuid();
            var mockCommunicationControllerFactory = new Mock <ICommunicationControllerFactory>();
            var mockGetVersionsController          = new Mock <ICommunicationController>();

            mockGetVersionsController.Setup(o => o.AddPayloadArgument("resourceId", resourceId.ToString())).Verifiable();


            var explorerItem = new Mock <IExplorerItem>
            {
                Name = "Item1",
            };
            var v1 = new VersionInfo
            {
                VersionNumber = "v1.0.0"
            };

            explorerItem.Setup(o => o.VersionInfo).Returns(v1);
            var items = new List <IExplorerItem>
            {
                explorerItem.Object
            };

            mockGetVersionsController.Setup(o => o.ExecuteCommand <IList <IExplorerItem> >(mockEnvironmentConnection.Object, It.IsAny <Guid>())).Returns(items);

            mockCommunicationControllerFactory.Setup(o => o.CreateController("GetVersions")).Returns(mockGetVersionsController.Object);


            var communicationControllerFactory = mockCommunicationControllerFactory.Object;
            var studioServerProxy = new StudioServerProxy(communicationControllerFactory, mockEnvironmentConnection.Object);
            var mockQueryManager  = new Mock <IQueryManager>();
            var versionManager    = new VersionManagerProxy(communicationControllerFactory, mockEnvironmentConnection.Object);

            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = versionManager;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.MoveItem(It.IsAny <Guid>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(ValueFunction(ExecStatus.Fail));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            var item = studioServerProxy.GetVersions(resourceId);

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);
            Assert.AreEqual(v1.VersionNumber, item.FirstOrDefault().VersionNumber);
            //mockVersionManager.Verify(manager => manager.GetVersions(It.IsAny<Guid>()));
            mockGetVersionsController.Verify();
        }
예제 #7
0
        public void StudioServerProxy_Rename_WhenNullItem_ShouldThrowException()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);

            //------------Execute Test---------------------------
            studioServerProxy.Rename(default(IExplorerItemViewModel), It.IsAny <string>());
            //------------Assert Results-------------------------
        }
        public void change_sql_source_verify_Empty_Inputs()
        {
            var newName         = Guid.NewGuid().ToString();
            var cleanProcName   = newName.Replace("-", "").Replace(" ", "");
            var createProcedure = "CREATE procedure [dbo].[" + cleanProcName + "](@ProductId int) as Begin select * from Country select * from City end";
            var result          = SqlHelper.RunSqlCommand(createProcedure);

            Assert.AreEqual(-1, result);
            var inputs = new List <IServiceInput>()
            {
                new ServiceInput("ProductId", "[[ProductId]]")
                {
                    ActionName = "dbo." + cleanProcName
                }
            };
            var sqlActivity = new DsfSqlServerDatabaseActivity()
            {
                Inputs        = inputs,
                ActionName    = "dbo." + cleanProcName,
                ProcedureName = "dbo." + cleanProcName,
                SourceId      = new Guid("b9184f70-64ea-4dc5-b23b-02fcd5f91082")
            };
            var modelItem        = ModelItemUtils.CreateModelItem(sqlActivity);
            var environmentModel = ServerRepository.Instance.Source;

            environmentModel.Connect();
            var environmentConnection = environmentModel.Connection;
            var controllerFactory     = new CommunicationControllerFactory();
            var _proxyLayer           = new StudioServerProxy(controllerFactory, environmentConnection);
            var mock           = new Mock <IShellViewModel>();
            var dbServiceModel = new ManageDbServiceModel(new StudioResourceUpdateManager(controllerFactory, environmentConnection)
                                                          , _proxyLayer.QueryManagerProxy
                                                          , mock.Object
                                                          , environmentModel);
            var source         = new DatabaseSourceRegion(dbServiceModel, modelItem, Common.Interfaces.Core.DynamicServices.enSourceType.SqlDatabase);
            var selectedSource = source.Sources.Single(a => a.Id == sqlActivity.SourceId);

            source.SelectedSource = selectedSource;
            var actionRegion = new DbActionRegion(dbServiceModel, modelItem, source, new SynchronousAsyncWorker());

            var mockSource = new Mock <IDbSource>();

            IDatabaseInputRegion databaseInputRegion = new DatabaseInputRegion(modelItem, actionRegion);

            Assert.AreEqual(1, databaseInputRegion.Inputs.Count);
            Assert.AreEqual("ProductId", databaseInputRegion.Inputs.Single().Name);
            Assert.AreEqual("[[ProductId]]", databaseInputRegion.Inputs.Single().Value);
            //add testing here

            source.SelectedSource = mockSource.Object;
            Assert.AreEqual(0, databaseInputRegion.Inputs.Count);
        }
예제 #9
0
        public void StudioServerProxy_LoadExplorer_Called_ShouldLoadExplorerItems()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager  = new Mock <IQueryManager>();

            mockQueryManager.Setup(manager => manager.Load(false, It.IsAny <IPopupController>())).Returns(Task.FromResult(new Mock <IExplorerItem>().Object));
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            //------------Execute Test---------------------------
            var item = studioServerProxy.LoadExplorer().Result;

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);
        }
예제 #10
0
        public void StudioServerProxy_Constructor_WhenValidArgs_ShouldConstuct()
        {
            //------------Setup for test--------------------------


            //------------Execute Test---------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);

            //------------Assert Results-------------------------
            Assert.IsNotNull(studioServerProxy);
            Assert.IsNotNull(studioServerProxy.QueryManagerProxy);
            Assert.IsNotNull(studioServerProxy.UpdateManagerProxy);
            Assert.IsNotNull(studioServerProxy.VersionManager);
            Assert.IsNotNull(studioServerProxy.AdminManagerProxy);
        }
예제 #11
0
        public void CreateDBServiceModel(IServer environmentModel)
        {
            var environmentConnection = environmentModel.Connection;
            var controllerFactory     = new CommunicationControllerFactory();

            _proxyLayer = new StudioServerProxy(controllerFactory, environmentConnection);
            var mock           = new Mock <IShellViewModel>();
            var dbServiceModel = new ManageDbServiceModel(new StudioResourceUpdateManager(controllerFactory, environmentConnection)
                                                          , _proxyLayer.QueryManagerProxy
                                                          , mock.Object
                                                          , environmentModel);

            _scenarioContext.Add("dbServiceModel", dbServiceModel);
            _scenarioContext.Add("proxyLayer", _proxyLayer);
        }
        private void CreateDbServiceModel()
        {
            var environmentModel = ServerRepository.Instance.Source;

            environmentModel.ConnectAsync().Wait(60000);
            var environmentConnection = environmentModel.Connection;
            var controllerFactory     = new CommunicationControllerFactory();

            var _proxyLayer = new StudioServerProxy(controllerFactory, environmentConnection);
            var mock        = new Mock <IShellViewModel>();

            _dbServiceModel = new ManageDbServiceModel(new StudioResourceUpdateManager(controllerFactory, environmentConnection)
                                                       , _proxyLayer.QueryManagerProxy
                                                       , mock.Object
                                                       , environmentModel);
        }
        public void GivenWarewolfServerIsRunning()
        {
            var environmentModel = ServerRepository.Instance.Source;

            if (!environmentModel.IsConnected)
            {
                environmentModel.Connect();
            }
            var controllerFactory     = new CommunicationControllerFactory();
            var environmentConnection = environmentModel.Connection;
            var manager = new StudioResourceUpdateManager
                              (controllerFactory, environmentConnection);
            var proxyLayer = new StudioServerProxy(controllerFactory, environmentConnection);

            ScenarioContext.Current.Add("environmentModel", environmentModel);
            ScenarioContext.Current.Add("studioResourceUpdateManager", manager);
            ScenarioContext.Current.Add("proxyLayer", proxyLayer);
        }
예제 #14
0
        public void StudioServerProxy_CreateFolder_VerifyFolderCreated()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();

            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            var updateManagerProxy = new Mock <IExplorerUpdateManager>();

            updateManagerProxy.Setup(manager => manager.AddFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>()));
            studioServerProxy.UpdateManagerProxy = updateManagerProxy.Object;
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            studioServerProxy.CreateFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>());
            //------------Assert Results-------------------------
            updateManagerProxy.Verify(manager => manager.AddFolder(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Guid>()));
        }
예제 #15
0
        public void StudioServerProxy_HasDependencies_GivenNoNodes_ShowDepenciesIsFalse()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mock = new Mock <IExplorerItemViewModel>();
            var dependencyGraphGenerator = new Mock <IDependencyGraphGenerator>();

            dependencyGraphGenerator.Setup(generator => generator.BuildGraph(It.IsAny <StringBuilder>(), It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>()))
            .Returns(new Graph("myGraph"));
            var msgMock = new Mock <IExecuteMessage>();
            //------------Execute Test---------------------------
            var metaData = studioServerProxy.HasDependencies(mock.Object, dependencyGraphGenerator.Object, msgMock.Object, new Mock <IPopupController>().Object);

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(metaData, typeof(IDeletedFileMetadata));
            var deletedFileMetadata = metaData;

            Assert.IsNotNull(deletedFileMetadata);
            Assert.AreEqual(true, deletedFileMetadata.IsDeleted);
            Assert.AreEqual(false, deletedFileMetadata.ShowDependencies);
            Assert.AreEqual(mock.Object.ResourceId, deletedFileMetadata.ResourceId);
        }
예제 #16
0
        public void StudioServerProxy_GetVersion_WhenGivenVersion_ShouldLoadUsingVersion()
        {
            //------------Setup for test--------------------------
            var studioServerProxy  = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mockQueryManager   = new Mock <IQueryManager>();
            var mockVersionManager = new Mock <IVersionManager>();
            var versionInfo        = new VersionInfo();

            mockVersionManager.Setup(manager => manager.GetVersion(versionInfo, It.IsAny <Guid>()))
            .Returns(new StringBuilder())
            .Verifiable();
            studioServerProxy.QueryManagerProxy = mockQueryManager.Object;
            studioServerProxy.VersionManager    = mockVersionManager.Object;
            //------------Execute Test---------------------------
            var treeItem = new Mock <IExplorerTreeItem>();

            treeItem.Setup(explorerTreeItem => explorerTreeItem.ResourcePath);
            var item = studioServerProxy.GetVersion(versionInfo, It.IsAny <Guid>());

            //------------Assert Results-------------------------
            Assert.IsNotNull(item);

            mockVersionManager.Verify(manager => manager.GetVersion(versionInfo, It.IsAny <Guid>()));
        }
        public void Add_A_New_InputOnSqlProcedure_Expect_New_IS_InputAdded()
        {
            var newName         = Guid.NewGuid().ToString();
            var cleanProcName   = newName.Replace("-", "").Replace(" ", "");
            var dropProcedure   = "USE [Dev2TestingDB]  DROP PROCEDURE [dbo].[" + cleanProcName + "]";
            var createProcedure = "CREATE procedure [dbo].[" + cleanProcName + "](@ProductId int) as Begin select * from Country select * from City end";
            var result          = SqlHelper.RunSqlCommand(createProcedure);

            Assert.AreEqual(-1, result);
            var inputs = new List <IServiceInput>()
            {
                new ServiceInput("ProductId", "[[ProductId]]")
                {
                    ActionName = "dbo." + cleanProcName
                }
            };
            var sqlActivity = new DsfSqlServerDatabaseActivity()
            {
                Inputs        = inputs,
                ActionName    = "dbo." + cleanProcName,
                ProcedureName = "dbo." + cleanProcName,
                SourceId      = new Guid("b9184f70-64ea-4dc5-b23b-02fcd5f91082")
            };
            var modelItem        = ModelItemUtils.CreateModelItem(sqlActivity);
            var environmentModel = ServerRepository.Instance.Source;

            environmentModel.Connect();
            var environmentConnection = environmentModel.Connection;
            var controllerFactory     = new CommunicationControllerFactory();
            var _proxyLayer           = new StudioServerProxy(controllerFactory, environmentConnection);
            var mock           = new Mock <IShellViewModel>();
            var dbServiceModel = new ManageDbServiceModel(new StudioResourceUpdateManager(controllerFactory, environmentConnection)
                                                          , _proxyLayer.QueryManagerProxy
                                                          , mock.Object
                                                          , environmentModel);
            var source         = new DatabaseSourceRegion(dbServiceModel, modelItem, Common.Interfaces.Core.DynamicServices.enSourceType.SqlDatabase);
            var selectedSource = source.Sources.Single(a => a.Id == sqlActivity.SourceId);

            source.SelectedSource = selectedSource;
            var actionRegion = new DbActionRegion(dbServiceModel, modelItem, source, new SynchronousAsyncWorker());


            var diffAction = actionRegion.Actions.First(p => p.Name != sqlActivity.ProcedureName);
            IDatabaseInputRegion databaseInputRegion = new DatabaseInputRegion(modelItem, actionRegion);

            Assert.AreEqual(1, databaseInputRegion.Inputs.Count);
            Assert.AreEqual("ProductId", databaseInputRegion.Inputs.Single().Name);
            Assert.AreEqual("[[ProductId]]", databaseInputRegion.Inputs.Single().Value);
            //add testing here
            var alterProcedure = "ALTER procedure [dbo].[" + cleanProcName + "](@ProductId int,@ProductId1 int,@ProductId2 int) as Begin select * from Country select * from City end";
            //actionRegion.SelectedAction = diffAction;//trigger action changes
            var alterTableResults = SqlHelper.RunSqlCommand(alterProcedure);

            actionRegion.RefreshActionsCommand.Execute(null);
            var underTest = actionRegion.Actions.Single(p => p.Name.EndsWith(cleanProcName));

            Assert.AreEqual(3, databaseInputRegion.Inputs.Count);
            Assert.AreEqual("ProductId", underTest.Inputs.ToList()[0].Name);
            Assert.AreEqual("ProductId1", underTest.Inputs.ToList()[1].Name);
            Assert.AreEqual("ProductId2", underTest.Inputs.ToList()[2].Name);

            Assert.AreEqual("ProductId", databaseInputRegion.Inputs.ToList()[0].Name);
            Assert.AreEqual("[[ProductId]]", databaseInputRegion.Inputs.ToList()[0].Value);

            Assert.AreEqual("ProductId1", databaseInputRegion.Inputs.ToList()[1].Name);
            Assert.AreEqual("[[ProductId1]]", databaseInputRegion.Inputs.ToList()[1].Value);

            Assert.AreEqual("ProductId2", databaseInputRegion.Inputs.ToList()[2].Name);
            Assert.AreEqual("[[ProductId2]]", databaseInputRegion.Inputs.ToList()[2].Value);
            Assert.AreEqual(-1, alterTableResults);
            var resultForDrop = SqlHelper.RunSqlCommand(dropProcedure);

            Assert.AreEqual(-1, resultForDrop);
        }