Esempio n. 1
0
            public void SetUp()
            {
                var wordsFilterMock = Substitute.For <IWordsFilter>();

                wordsFilterMock.Filter(Arg.Any <IEnumerable <string> >()).Returns(Enumerable.Repeat("mock", 100));

                var fileReaderMock = Substitute.For <IFileReader>();

                fileReaderMock.ReadFile(Arg.Any <string>()).Returns(Enumerable.Repeat("mock", 100));

                var layoutNormalizerMock = Substitute.For <ILayoutNormalizer>();
                var rect       = new Rectangle(0, 0, 1000, 1000);
                var wordInRect = new WordInRect("kek", rect, new Font("Arial", 10));

                layoutNormalizerMock.GetMainRect(Arg.Any <IEnumerable <WordInRect> >()).Returns(rect);
                layoutNormalizerMock.ShiftLayout(Arg.Any <IEnumerable <WordInRect> >(), rect)
                .Returns(Enumerable.Repeat(wordInRect, 100).ToArray());

                var builder = new ContainerBuilder();

                builder.RegisterInstance(new FrequencyAnalyzer()).As <IFrequencyAnalyzer>();
                builder.RegisterInstance(new DictionaryNormalizer()).As <IDictionaryNormalizer>();
                builder.RegisterInstance(new CloudLayouter(new Point(0, 0), 1))
                .As <ICloudLayouter>();


                builder.RegisterInstance(wordsFilterMock).As <IWordsFilter>();
                builder.RegisterInstance(layoutNormalizerMock).As <ILayoutNormalizer>();
                builder.RegisterType <CloudBuilder>().As <ICloudBuilder>();
                builder.RegisterType <CloudDrawer>().As <ICloudDrawer>();
                builder.RegisterInstance(fileReaderMock).As <IFileReader>();
                builder.RegisterInstance(new CloudSaver()).As <ICloudSaver>();
                var container = builder.Build();

                cloudBuilder = container.Resolve <ICloudBuilder>();
            }
Esempio n. 2
0
 public SolidBrush GenerateBrush(WordInRect wordInRect)
 {
     return(Brush);
 }