public void DecorateLineTests_IndexTesting_ExpectedBehavior(string text, int start, int end, int[] spans, int colorIndex) { decorator.DecorateLine(text, start, end); if (spans.Length > 1) { int correctLength = spans[1] - spans[0]; mocker.Verify <IBackgroundTextIndexDrawer>( p => p.DrawBackground( spans[0], It.IsIn(correctLength), rainbowgetter.GetColorByIndex(colorIndex)), Times.Once() ); } mocker.Verify <IBackgroundTextIndexDrawer>( p => p.DrawBackground( It.IsNotIn(spans), It.IsNotIn(4), It.IsAny <Brush>() ), Times.Never() ); }
public void DecorateLineTests_ColorTesting_ExpectedBehavior(string text) { MockSequence sequence = new MockSequence(); Mock <IBackgroundTextIndexDrawer> colorMock = mocker.GetMock <IBackgroundTextIndexDrawer>(); for (int i = 0; i < text.Length / FSI.Length; i++) { colorMock.InSequence(sequence).Setup( p => p.DrawBackground( It.IsAny <int>(), It.IsAny <int>(), It.IsAny <Brush>() ) ); } decorator.DecorateLine(text, 0, text.Length); for (int i = 0; i < text.Length / FSI.Length; i++) { colorMock.InSequence(sequence).Setup( p => p.DrawBackground( It.IsAny <int>(), It.IsAny <int>(), rainbowgetter.GetColorByIndex(i) ) ); } }
public void GetColorByIndex_EmptyCollectionHandling() { brushGetter = new RainbowBrushGetter(Array.Empty <Brush>(), null); Assert.IsNull(brushGetter.GetColorByIndex(1)); }
public void GetColorByIndex_ExpectedBehavior(int index, int internalTestIndex) { Brush result = brushGetter.GetColorByIndex(index); Assert.AreEqual(brushes[internalTestIndex], result); }