| | 1 | | using NUnit.Framework; |
| | 2 | | using UnityEngine; |
| | 3 | | using System.Linq; |
| | 4 | |
|
| | 5 | | namespace Tests.BuildModeHUDViews |
| | 6 | | { |
| | 7 | | public class BuilderInWorldLoadingViewShould |
| | 8 | | { |
| | 9 | | private BuilderInWorldLoadingView builderInWorldLoadingView; |
| | 10 | |
|
| | 11 | | [SetUp] |
| 4 | 12 | | public void SetUp() { builderInWorldLoadingView = BuilderInWorldLoadingView.Create(); } |
| | 13 | |
|
| | 14 | | [TearDown] |
| 4 | 15 | | public void TearDown() { Object.Destroy(builderInWorldLoadingView.gameObject); } |
| | 16 | |
|
| | 17 | | [Test] |
| | 18 | | public void ShowCorrectly() |
| | 19 | | { |
| | 20 | | // Arrange |
| 1 | 21 | | builderInWorldLoadingView.gameObject.SetActive(false); |
| 1 | 22 | | builderInWorldLoadingView.currentTipIndex = -1; |
| 1 | 23 | | builderInWorldLoadingView.tipsCoroutine = null; |
| | 24 | |
|
| | 25 | | // Act |
| 1 | 26 | | builderInWorldLoadingView.Show(); |
| | 27 | |
|
| | 28 | | // Assert |
| 1 | 29 | | Assert.IsTrue(builderInWorldLoadingView.gameObject.activeSelf, "The view activeSelf property is false!"); |
| 1 | 30 | | if (builderInWorldLoadingView.loadingTips.Count > 0) |
| | 31 | | { |
| 1 | 32 | | Assert.IsTrue(builderInWorldLoadingView.currentTipIndex >= 0, "currentTipIndex is less than 0!"); |
| 1 | 33 | | Assert.NotNull(builderInWorldLoadingView.tipsCoroutine, "tipsCoroutine is null!"); |
| | 34 | | } |
| 1 | 35 | | } |
| | 36 | |
|
| | 37 | | [Test] |
| | 38 | | public void HideCorrectly() |
| | 39 | | { |
| | 40 | | // Arrange |
| 1 | 41 | | builderInWorldLoadingView.gameObject.SetActive(true); |
| | 42 | |
|
| | 43 | | // Act |
| 1 | 44 | | builderInWorldLoadingView.Hide(true); |
| | 45 | |
|
| | 46 | | // Assert |
| 1 | 47 | | Assert.IsFalse(builderInWorldLoadingView.gameObject.activeSelf, "The view activeSelf property is true!"); |
| 1 | 48 | | } |
| | 49 | | } |
| | 50 | | } |