예제 #1
0
 public void TearDown()
 {
     if (TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Passed)
     {
         var directory     = TestContext.CurrentContext.TestDirectory;
         var fileExtension = ".png";
         var fileName      = TestContext.CurrentContext.Test.Name + fileExtension;
         var path          = Path.Combine(directory, fileName);
         var image         = visualizer.GetCloudImage();
         image.Save(path);
         TestContext.WriteLine($"Tag cloud visualization saved to file {path}");
     }
 }
예제 #2
0
        private static Bitmap GetCloudImageFromRandomRectangles(int rectanglesCount)
        {
            var visualizer = new CircularCloudVisualizer(new CircularCloudLayouter());
            var random     = new Random();

            for (int i = 0; i < rectanglesCount; i++)
            {
                Size nextRectSize;

                do
                {
                    nextRectSize = new Size(random.Next(200) + 100, random.Next(100) + 100);
                } while (nextRectSize.Width < nextRectSize.Height * 2);

                visualizer.Layouter.PutNextRectangle(nextRectSize);
            }

            return(visualizer.GetCloudImage());
        }