Пример #1
0
        public static async Task <TestRunSessionAgent> StartAsync(
            ITestRunClientConfiguration configuration,
            BuildInfo productBuild, string suiteName,
            int testBuildId, string testBuildNumber,
            string productLineKey = null,
            ILogger logger        = null,
            IDictionary <string, ExtraDataValue> extraData = null)
        {
            TestRunSessionRequest sessionRequest = new TestRunSessionRequest()
            {
                ProductBuild         = productBuild,
                AzureTestBuildId     = testBuildId,
                AzureTestBuildNumber = testBuildNumber,
                SuiteName            = suiteName,
                StartTime            = DateTime.Now,
                State       = TestRunSessionState.NotStarted,
                ExtraData   = extraData,
                ProductLine = new ProductLine()
                {
                    Key = productLineKey ?? ExtractBuildName(productBuild) ?? productBuild.AzureBuildDefinitionId.ToString(),
                    AzureProductBuildDefinitionId = productBuild.AzureBuildDefinitionId
                }
            };

            return(await TestRunSessionAgent.CreateAsync(configuration, sessionRequest, logger));
        }
 private TestRunSessionAgent(
     TestRunClient client,
     ITestRunClientConfiguration configuration,
     TestRunSessionResponse session,
     ProductLine productLine,
     ILogger logger)
 {
     _client        = client;
     _configuration = configuration;
     _session       = session;
     _productLine   = productLine;
     _project       = session.ProductBuild.TeamProject;
     _logger        = logger;
 }
        public static async Task <TestRunSessionAgent> CreateAsync(
            ITestRunClientConfiguration configuration,
            TestRunSessionRequest sessionRequest,
            ILogger logger = null)
        {
            logger = logger ?? new NullLogger();
            var client = new TestRunClient(configuration.TestRunServiceUrl);

            logger.Info("'TestRunClient' created.");

            var response = await client.InsertSessionAsync(sessionRequest);

            var productLine = response.ProductLine;

            logger.Debug("'TestRunSession' inserted: " + ObjToString(response));

            return(new TestRunSessionAgent(client, configuration, response, productLine, logger));
        }