コード例 #1
0
ファイル: TestScreenshot.cs プロジェクト: fossabot/Ghpr.Core
        public TestScreenshot()
        {
            var now = DateTime.Now;

            Name = LocationsProvider.GetScreenshotFileName(now);
            Date = now;
        }
コード例 #2
0
        public static void Save(this TestRun testRun, string path)
        {
            path.Create();
            var fullPath = Path.Combine(path, LocationsProvider.GetTestRunFileName(testRun.TestInfo.Finish));

            using (var file = File.CreateText(fullPath))
            {
                var serializer = new JsonSerializer();
                serializer.Serialize(file, testRun);
            }
        }
コード例 #3
0
        public static ItemInfo MapTestRunInfo(this ItemInfoDto itemInfoDto)
        {
            var run = new ItemInfo
            {
                Guid     = itemInfoDto.Guid,
                Start    = itemInfoDto.Start,
                Finish   = itemInfoDto.Finish,
                FileName = LocationsProvider.GetTestRunFileName(itemInfoDto.Finish)
            };

            return(run);
        }
コード例 #4
0
        public static void Save(this Run run, string path)
        {
            var fileName = LocationsProvider.GetRunFileName(run.RunInfo.Guid);

            run.RunInfo.FileName = fileName;
            path.Create();
            var fullRunPath = Path.Combine(path, fileName);

            using (var file = File.CreateText(fullRunPath))
            {
                var serializer = new JsonSerializer();
                serializer.Serialize(file, run);
            }
        }
コード例 #5
0
ファイル: RunDtoMapper.cs プロジェクト: fossabot/Ghpr.Core
        public static Run Map(this RunDto runDto)
        {
            var run = new Run
            {
                TestRunFiles = runDto.TestsInfo.Select(
                    ti => Path.Combine(ti.Guid.ToString(), LocationsProvider.GetTestRunFileName(ti.Finish))).ToList(),
                Name       = runDto.Name,
                RunInfo    = runDto.RunInfo.MapRunInfo(),
                RunSummary = runDto.RunSummary.Map(),
                Sprint     = runDto.Sprint
            };

            return(run);
        }
コード例 #6
0
 public void SaveScreenshot(TestScreenshotDto testScreenshot)
 {
     using (var image = Image.FromStream(new MemoryStream(testScreenshot.Data)))
     {
         var screenPath = _locationsProvider.GetScreenshotPath(testScreenshot.TestGuid.ToString());
         screenPath.Create();
         var screenName = LocationsProvider.GetScreenshotFileName(testScreenshot.Date);
         var file       = Path.Combine(screenPath, screenName);
         var screen     = new Bitmap(image);
         screen.Save(file, ImageFormat.Png);
         var fileInfo = new FileInfo(file);
         fileInfo.Refresh();
         fileInfo.CreationTime = testScreenshot.Date;
     }
 }
コード例 #7
0
        public static TestRun Map(this TestRunDto testRunDto)
        {
            var testRun = new TestRun
            {
                Categories  = testRunDto.Categories,
                Description = testRunDto.Description,
                Events      = testRunDto.Events.Select(teDto => new TestEvent
                {
                    Started  = teDto.Started,
                    Finished = teDto.Finished,
                    Name     = teDto.Name
                }).ToList(),
                FullName    = testRunDto.FullName,
                Name        = testRunDto.Name,
                Output      = testRunDto.Output,
                Priority    = testRunDto.Priority,
                Result      = testRunDto.Result,
                RunGuid     = testRunDto.RunGuid,
                Screenshots = testRunDto.Screenshots.Select(sDto => new TestScreenshot
                {
                    Date = sDto.Date,
                    Name = LocationsProvider.GetScreenshotFileName(sDto.Date)
                }).ToList(),
                TestInfo       = testRunDto.TestInfo.MapTestRunInfo(),
                TestDuration   = (testRunDto.TestInfo.Finish - testRunDto.TestInfo.Start).TotalSeconds,
                TestMessage    = testRunDto.TestMessage,
                TestStackTrace = testRunDto.TestStackTrace,
                TestType       = testRunDto.TestType,
                TestData       = testRunDto.TestData.Select(tdDto => new TestData
                {
                    Actual   = tdDto.Actual,
                    Expected = tdDto.Expected,
                    Comment  = tdDto.Comment,
                    Date     = tdDto.Date
                }).ToList()
            };

            return(testRun);
        }
コード例 #8
0
ファイル: TestScreenshot.cs プロジェクト: fossabot/Ghpr.Core
 public TestScreenshot(DateTime date)
 {
     Name = LocationsProvider.GetScreenshotFileName(date);
     Date = date;
 }
コード例 #9
0
 public void Initialize(ReporterSettings settings)
 {
     _locationsProvider = new LocationsProvider(settings.OutputPath);
     ReporterSettings   = settings;
 }