public void AddRowTest() { var percentWidths = new[] { 20, 30, 50 }; var controls = new[] { new InputBox(new XRect(0, 0, 10, 20), ""), new InputBox(new XRect(0, 0, 10, 30), ""), new InputBox(new XRect(0, 0, 10, 50), ""), }; var rect = new XRect(0, 0, 100 + DefaultValues.Groupbox.MarginLeft + DefaultValues.Groupbox.MarginRight, 10); var target = new GroupBox(rect); target.AddRow(controls, percentWidths); foreach (var control in controls.Zip(target.Controls, (i, o) => new { Input = i, Output = o })) { Assert.AreSame(control.Input, control.Output); } Assert.AreEqual(target.Controls.ElementAt(0).Rect.Left, 0); Assert.AreEqual(target.Controls.ElementAt(1).Rect.Left, 20); Assert.AreEqual(target.Controls.ElementAt(2).Rect.Left, 50); Assert.AreEqual(target.Controls.ElementAt(0).Rect.Width, 20); Assert.AreEqual(target.Controls.ElementAt(1).Rect.Width, 30); Assert.AreEqual(target.Controls.ElementAt(2).Rect.Width, 50); Assert.AreEqual(target.Rect.Height, target.MarginBottom + target.MarginTop + 50); }
public void CanZipTwoSameLengthSequences() { var seq1 = new[] { 1, 2, 3 }; var seq2 = new[] { "um", "dois", "três" }; var seq3 = seq1.Zip(seq2, (x, y) => x + y).ToList(); seq3.Should().Have.SameSequenceAs("1um", "2dois", "3três"); }
public void CanZipThreeSequences() { var seq1 = new[] { 1, 2, 3, 4 }; var seq2 = new[] { 1, 2 }; var seq3 = new[] { "um", "dois", "três" }; var seq4 = seq1.Zip(seq2, (x, y) => x * y).Zip(seq3, (x, y) => x + y).ToList(); seq4.Should().Have.SameSequenceAs("1um", "4dois"); }