Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Scenes.Tests.Controls SelectBoxTests
Namespace: DeltaEngine.Scenes.Tests.Controls
Assembly: DeltaEngine.Scenes.Tests (in DeltaEngine.Scenes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The SelectBoxTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SelectBoxTests | Initializes a new instance of the SelectBoxTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
DrawLoadedSelectBox | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
RenderGrowingSelectBox | ||
RenderSelectBoxAttachedToMouse | ||
RenderSelectBoxWithTenValuesAndThreeLines | ||
RenderSelectBoxWithThreeValuesAndThreeLines | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
SaveAndLoad | ||
SetUp | ||
SetValuesAsNull |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void RenderSelectBoxWithThreeValuesAndThreeLines() { var text = new FontText(Font.Default, "", new Rectangle(0.4f, 0.7f, 0.2f, 0.1f)); selectBox.LineClicked += lineNo => text.Text = selectBox.Values[lineNo] + " clicked"; }
[Test] public void RenderSelectBoxWithTenValuesAndThreeLines() { SetToTenValues(); var text = new FontText(Font.Default, "", new Rectangle(0.4f, 0.7f, 0.2f, 0.1f)); selectBox.LineClicked += lineNo => text.Text = selectBox.Values[lineNo] + " clicked"; }
[Test] public void RenderSelectBoxAttachedToMouse() { selectBox.Values = new List<object> { "value 1", "value 2", "value 3", "value 4" }; new Command( point => selectBox.DrawArea = Rectangle.FromCenter(point, selectBox.DrawArea.Size)).Add( new MouseMovementTrigger()); }
[Test] public void SetValuesAsNull() { Assert.Throws<SelectBox.MustBeAtLeastOneValue>(() => selectBox.Values = null); }
[Test] public void RenderGrowingSelectBox() { selectBox.Values = new List<object> { "value 1", "value 2", "value 3", "value 4" }; selectBox.Start<Grow>(); var text = new FontText(Font.Default, "", new Rectangle(0.4f, 0.7f, 0.2f, 0.1f)); selectBox.LineClicked += lineNo => text.Text = selectBox.Values[lineNo] + " clicked"; }
[Test, CloseAfterFirstFrame] public void SaveAndLoad() { var stream = BinaryDataExtensions.SaveToMemoryStream(selectBox); var loadedSelectBox = (SelectBox)stream.CreateFromMemoryStream(); Assert.AreEqual(selectBox.DrawArea, loadedSelectBox.DrawArea); Assert.AreEqual(3, loadedSelectBox.Values.Count); Assert.AreEqual(selectBox.Values[1].ToString(), loadedSelectBox.Values[1].ToString()); }
[Test] public void DrawLoadedSelectBox() { SetToTenValues(); var stream = BinaryDataExtensions.SaveToMemoryStream(selectBox); selectBox.IsActive = false; var loadedSelectBox = (SelectBox)stream.CreateFromMemoryStream(); var text = new FontText(Font.Default, "", new Rectangle(0.4f, 0.7f, 0.2f, 0.1f)); loadedSelectBox.LineClicked += lineNo => text.Text = loadedSelectBox.Values[lineNo] + " clicked"; //ncrunch: no coverage }
See Also