Exemplo n.º 1
0
        public void SetUp()
        {
            defaultWords = new List <string> {
                "di", "solid", "mocking", "unit", "to"
            };
            defaultHeights = Enumerable.Repeat(30, defaultWords.Count).ToList();

            wordsPreprocessor1 = A.Fake <IWordsPreprocessor>();
            wordsPreprocessor2 = A.Fake <IWordsPreprocessor>();
            wordsFilter1       = A.Fake <IWordsFilter>();
            wordsFilter2       = A.Fake <IWordsFilter>();
            wordsFramer        = A.Fake <IWordsHeighter>();
            layouter           = A.Fake <ICloudLayouter>();
            writer             = A.Fake <IWordsBitmapWriter>();

            A.CallTo(() => wordsPreprocessor1.Process(null)).WithAnyArguments().Returns(defaultWords);
            A.CallTo(() => wordsPreprocessor2.Process(null)).WithAnyArguments().Returns(defaultWords);
            A.CallTo(() => wordsFilter1.GetFiltered(null)).WithAnyArguments().Returns(defaultWords);
            A.CallTo(() => wordsFilter2.GetFiltered(null)).WithAnyArguments().Returns(defaultWords);
            A.CallTo(() => wordsFramer.GetWithHeights(null)).WithAnyArguments().Returns(defaultWords.Zip(defaultHeights, Tuple.Create));
            A.CallTo(() => layouter.PutNextRectangle(Size.Empty)).WithAnyArguments().Returns(Rectangle.Empty);
            A.CallTo(() => writer.Write(null)).WithAnyArguments().Returns(bitmapResult);

            container = new CloudContainer(
                new [] { wordsPreprocessor1, wordsPreprocessor2 },
                new [] { wordsFilter1, wordsFilter2 },
                wordsFramer,
                layouter,
                writer, ImageFormat.Bmp);
        }
Exemplo n.º 2
0
 public void CallAllPreprocessors()
 {
     container.GetTagsCloud(defaultWords);
     A.CallTo(() => wordsPreprocessor1.Process(null)).WithAnyArguments().MustHaveHappened();
     A.CallTo(() => wordsPreprocessor2.Process(null)).WithAnyArguments().MustHaveHappened();
 }