Esempio n. 1
0
        /// <summary>
        /// Upload result level attachment
        /// </summary>
        /// <param name="_testLogStore"></param>
        /// <param name="projectId"></param>
        /// <param name="runId"></param>
        /// <param name="resultId"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public async Task <TestLogStatus> UploadResultLevelAttachment(ITestLogStore _testLogStore, string projectId, int runId, int resultId, string filePath)
        {
            try
            {
                TestLogStatus testLogResult     = null;
                var           cancellationToken = new CancellationToken();

                Console.WriteLine("\nUpload started..");
                testLogResult = await _testLogStore.UploadTestRunLogAsync(new Guid(projectId), runId, resultId, 0, TestLogType.GeneralAttachment, filePath, null, "", true, cancellationToken).ConfigureAwait(false);

                if (testLogResult.Status == TestLogStatusCode.Success)
                {
                    Console.WriteLine("Upload completed...");
                }
                else
                {
                    Console.WriteLine("Upload failed..." + testLogResult.Exception);
                }

                return(testLogResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Upload directory for build
        /// </summary>
        /// <param name="_testLogStore"></param>
        /// <param name="projectId"></param>
        /// <param name="buildId"></param>
        /// <param name="logDirectoryPath"></param>
        /// <param name="destinationDirectoryPath"></param>
        /// <returns></returns>
        public async Task <TestLogStatus> UploadBuildDirectoryAttachment(ITestLogStore _testLogStore, string projectId, int buildId, string logDirectoryPath, string destinationDirectoryPath)
        {
            try
            {
                TestLogStatus testLogResult     = null;
                var           cancellationToken = new CancellationToken();

                Console.WriteLine("\nUpload started..");
                testLogResult = await _testLogStore.UploadTestBuildDirectoryAsync(new Guid(projectId), buildId, TestLogType.GeneralAttachment, logDirectoryPath, null, destinationDirectoryPath, cancellationToken).ConfigureAwait(false);

                if (testLogResult.Status == TestLogStatusCode.Success)
                {
                    Console.WriteLine("Upload completed...");
                }
                else
                {
                    Console.WriteLine("Upload failed..." + testLogResult.Exception);
                }

                return(testLogResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Download attachment
        /// </summary>
        /// <param name="_testLogStore"></param>
        /// <param name="projectId"></param>
        /// <param name="runId"></param>
        /// <param name="resultId"></param>
        /// <param name="subResultId"></param>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public async Task <TestLogStatus> DownloadAttachment(ITestLogStore _testLogStore, string projectId, int runId, int resultId, int subResultId, string filePath)
        {
            try
            {
                TestLogStatus testLogResult     = null;
                var           cancellationToken = new CancellationToken();

                TestLogReference testLogReference = new TestLogReference();
                testLogReference.RunId       = runId;
                testLogReference.ResultId    = resultId;
                testLogReference.SubResultId = subResultId;
                testLogReference.FilePath    = filePath;
                testLogReference.Type        = TestLogType.GeneralAttachment;
                testLogReference.Scope       = TestLogScope.Run;

                MemoryStream memoryStream = new MemoryStream();
                await _testLogStore.DownloadTestLogAsync(new Guid(projectId), testLogReference, memoryStream, cancellationToken).ConfigureAwait(false);

                if (memoryStream != null)
                {
                    Console.WriteLine("\nStreaming...........");
                    Console.WriteLine(System.Text.Encoding.UTF8.GetString(memoryStream.ToArray()));
                }

                return(testLogResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TestLog(int id, string sn, string line, string fixtureid, string station, TestLogStatus status, string joinId, string editor, string type, DateTime cdt)
        {
            this._id = id;
            this._sn = sn;
            this._line = line;
            this._fixtureid = fixtureid;
            this._station = station;
            this._status = status;
            this._joinId = joinId;
            this._editor = editor;
            this._type = type;
            this._cdt = cdt;

            this._tracker.MarkAsAdded(this);
        }
Esempio n. 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TestLog(int id, string sn, string line, string fixtureid, string station, IEnumerable<TestLogDefect> defects, TestLogStatus status, string joinId, string editor, string type, DateTime cdt)
        {
            this._id = id;
            this._sn = sn;
            this._line = line;
            this._fixtureid = fixtureid;
            this._station = station;
            this._status = status;
            this._joinId = joinId;
            this._editor = editor;
            this._type = type;
            this._cdt = cdt;

            this._tracker.MarkAsAdded(this);

            _defects = new List<TestLogDefect>();
            foreach (var defect in defects)
            {
                defect.Tracker = this._tracker.Merge(defect.Tracker);
                this._defects.Add(defect);
                this._tracker.MarkAsAdded(defect);
                this._tracker.MarkAsModified(this);
            }

        }