public void GetSpan_Always_InvokesGetValueWithSpanProperty(double value) { var uut = new FrameworkElement(); uut.SetValue(StretchPanel.SpanProperty, value); StretchPanel.GetSpan(uut).ShouldBe(value); }
public void ArrangeOverride_OrientationIsHorizontal_InvokesChildrenEachArrangeWithFinalRectSizeExpected(double finalSizeWidth, double finalSizeHeight, params double[] childrenEachSpan) { var context = new TestContext() { orientation = Orientation.Horizontal, children = MakeFakeChildren(childrenEachSpan) }; var uut = context.ConstructUUT(); var totalSpan = childrenEachSpan.Sum(); var finalSize = new Size(finalSizeWidth, finalSizeHeight); uut.Arrange(new Rect(finalSize)); context.children.ShouldSatisfyAllConditions( () => context.children.ForEach(x => x.ActualWidth.ShouldBe(finalSizeWidth * StretchPanel.GetSpan(x) / totalSpan)), () => context.children.ForEach(x => x.ActualHeight.ShouldBe(finalSizeHeight))); }
public void MeasureOverride_OrientationIsHorizontal_InvokesChildrenEachMeasure(double availableSizeWidth, double availableSizeHeight, params double[] childrenEachSpan) { var context = new TestContext() { orientation = Orientation.Horizontal, children = MakeFakeChildren(childrenEachSpan) }; var uut = context.ConstructUUT(); var totalSpan = childrenEachSpan.Sum(); var availableSize = new Size(availableSizeWidth, availableSizeHeight); uut.Measure(availableSize); context.children.ShouldSatisfyAllConditions( () => context.children.ForEach(x => x.MeasureOverride_AvailableSize.Width.ShouldBe(availableSizeWidth * StretchPanel.GetSpan(x) / totalSpan)), () => context.children.ForEach(x => x.MeasureOverride_AvailableSize.Height.ShouldBe(availableSizeHeight))); }