private void DrawWords(IList <WordRectangle> wordRectangles, Graphics graphics) { foreach (var wordRectangle in wordRectangles) { var font = settings.GetFont(wordRectangle); var brush = settings.GetBrush(wordRectangle); graphics.DrawString(wordRectangle.Word, font, brush, wordRectangle.Rectangle); } }
public void DrawImage_ShouldCallSettingsMethodsForEveryTag() { var size = new Size(100, 100); var wordRectangles = new List <WordRectangle> { new WordRectangle("земля", new Rectangle(3, 3, 10, 10)), new WordRectangle("привет", new Rectangle(15, 15, 20, 20)) }; var image = visualizer.DrawImage(wordRectangles, size); A.CallTo(() => settings.GetFont(null)) .WithAnyArguments() .MustHaveHappenedTwiceExactly(); A.CallTo(() => settings.GetBrush(null)) .WithAnyArguments() .MustHaveHappenedTwiceExactly(); }
public void CreateVisualizer() { var font = new Font(FontFamily.GenericMonospace, 10, FontStyle.Regular, GraphicsUnit.Pixel); settings = A.Fake <IVisualizerSettings>(); A.CallTo(() => settings.GetFont(null)) .WithAnyArguments() .Returns(font); A.CallTo(() => settings.GetBrush(null)) .WithAnyArguments() .Returns(Brushes.Black); A.CallTo(() => settings.BackgroundBrush) .WithAnyArguments() .Returns(Brushes.White); visualizer = new TagCloudVisualizer(settings); }