Esempio n. 1
0
        public void TestMethod1()
        {
            var eventAggregatorMock = new Mock<IEventAggregator>();
            var tfsbuild = new TFSBuild(new TFSConnectivity(new WorkflowManagerStorage(eventAggregatorMock.Object), eventAggregatorMock.Object)); // todo mock storage?
            tfsbuild.Connectivity.Connect("http://vsalm:8080/tfs/FabrikamFiberCollection", "FabrikamFiber");

            var buildDefinitions = tfsbuild.QueryBuildDefinitions();

            foreach (var bd in buildDefinitions)
            {
                if (bd.Name.Contains("BDT"))
                {
                    var process = WorkflowHelpers.DeserializeProcessParameters(bd.ProcessParameters);
                    if (process.ContainsKey("LabWorkflowParameters"))
                    {
                        var param = process["LabWorkflowParameters"];
                        if (param != null)
                        {
                            var lwd = param as LabWorkflowDetails;
                            if (lwd != null)
                            {
                                var buildDefinitionName = lwd.BuildDetails.BuildDefinitionName;
                                var buildDefinitionUri = lwd.BuildDetails.BuildDefinitionUri;
                                var buildUri = lwd.BuildDetails.BuildUri;
                                var configuration = lwd.BuildDetails.Configuration;
                                var customBuildPath = lwd.BuildDetails.CustomBuildPath;
                                var isTeamSystemBuild = lwd.BuildDetails.IsTeamSystemBuild;
                                var queueNewBuild = lwd.BuildDetails.QueueNewBuild;

                                var disposition = lwd.EnvironmentDetails.Disposition;
                                var HostGroupName = lwd.EnvironmentDetails.HostGroupName;
                                var LabEnvironmentName = lwd.EnvironmentDetails.LabEnvironmentName;
                                var LabEnvironmentUri = lwd.EnvironmentDetails.LabEnvironmentUri;
                                var LabLibraryShareName = lwd.EnvironmentDetails.LabLibraryShareName;
                                var NewLabEnvironmentName = lwd.EnvironmentDetails.NewLabEnvironmentName;
                                var ProjectName = lwd.EnvironmentDetails.ProjectName;
                                var RevertToSnapshot = lwd.EnvironmentDetails.RevertToSnapshot;
                                var SnapshotName = lwd.EnvironmentDetails.SnapshotName;
                                var TfsUrl = lwd.EnvironmentDetails.TfsUrl;

                                var scripts = lwd.DeploymentDetails.Scripts;

                                var planid = lwd.TestParameters.TestPlanId;
                                var testsuitelist = lwd.TestParameters.TestSuiteIdList;
                                var configurationdi = lwd.TestParameters.TestConfigurationId;
                            }
                        }
                    }
                }
            }
        }
        public void CreateBDTWorkflowFromScratch()
        {
            // Arrange
            var eventAggregatorMock = new Mock<IEventAggregator>();
            var tfsbuild = new TFSBuild(new TFSConnectivity(new WorkflowManagerStorage(eventAggregatorMock.Object), eventAggregatorMock.Object));
            tfsbuild.Connectivity.Connect("http://*****:*****@"notepad.exe", WorkingDirectory = @"C:\temp" } } },
                TestDetails = new LabWorkflowManager.TFS.Common.WorkflowConfig.TestDetails() { TestPlanId = 3, TestSuiteIdList = new ObservableCollection<int>() { 3, 4 }, TestConfigurationId = 1 }
            });

            // Assert
            var buildDefinitions = new List<IBuildDefinition>(tfsbuild.QueryBuildDefinitions());
            Assert.IsTrue(buildDefinitions.Any(o => o.Name.Equals(name)));
        }