public void ShouldRenderOnce_WhenRenderingCalledMultipleTimes() { var child = new Mock <Element>(); child .Setup(x => x.Measure(It.IsAny <Size>())) .Returns(() => new FullRender(Size.Zero)); var element = new ShowOnce() { Child = child.Object }; element.Draw(null, Size.Zero); element.Draw(null, Size.Zero); child.Verify(x => x.Draw(It.IsAny <ICanvas>(), It.IsAny <Size>()), Times.Once); }
public static IContainer ShowOnce(this IContainer element) { var alignment = new ShowOnce(); return(element.Element(alignment)); }