| | 1 | | using System.Collections; |
| | 2 | | using NUnit.Framework; |
| | 3 | | using UnityEngine.TestTools; |
| | 4 | |
|
| | 5 | | public class TermsOfServiceHUD_Should : IntegrationTestSuite_Legacy |
| | 6 | | { |
| 8 | 7 | | protected override bool justSceneSetUp => true; |
| | 8 | |
|
| | 9 | | private TermsOfServiceHUDController controller; |
| | 10 | | private TermsOfServiceHUDView view; |
| | 11 | |
|
| | 12 | | [UnitySetUp] |
| | 13 | | protected override IEnumerator SetUp() |
| | 14 | | { |
| 8 | 15 | | yield return base.SetUp(); |
| 8 | 16 | | controller = new TermsOfServiceHUDController(); |
| 8 | 17 | | view = controller.view; |
| 8 | 18 | | } |
| | 19 | |
|
| | 20 | | protected override IEnumerator TearDown() |
| | 21 | | { |
| 8 | 22 | | controller.Dispose(); |
| 8 | 23 | | yield return base.TearDown(); |
| 8 | 24 | | } |
| | 25 | |
|
| | 26 | | [Test] |
| | 27 | | public void SetTheViewVisibleWhenModelNotNull() |
| | 28 | | { |
| 1 | 29 | | view.content.SetActive(false); |
| | 30 | |
|
| 1 | 31 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model()); |
| | 32 | |
|
| 1 | 33 | | Assert.IsTrue(view.content.activeSelf); |
| 1 | 34 | | } |
| | 35 | |
|
| | 36 | | [Test] |
| | 37 | | public void SetTheViewVisibleWhenModelNull() |
| | 38 | | { |
| 1 | 39 | | view.content.SetActive(true); |
| | 40 | |
|
| 1 | 41 | | controller.ShowTermsOfService(null); |
| | 42 | |
|
| 1 | 43 | | Assert.IsFalse(view.content.activeSelf); |
| 1 | 44 | | } |
| | 45 | |
|
| | 46 | | [Test] |
| | 47 | | public void HideViewOnAgreed() |
| | 48 | | { |
| 1 | 49 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model()); |
| | 50 | |
|
| 1 | 51 | | view.agreedButton.onClick.Invoke(); |
| | 52 | |
|
| 1 | 53 | | Assert.IsFalse(view.content.activeSelf); |
| 1 | 54 | | } |
| | 55 | |
|
| | 56 | | [Test] |
| | 57 | | public void HideViewOnDeclined() |
| | 58 | | { |
| 1 | 59 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model()); |
| | 60 | |
|
| 1 | 61 | | view.declinedButton.onClick.Invoke(); |
| | 62 | |
|
| 1 | 63 | | Assert.IsFalse(view.content.activeSelf); |
| 1 | 64 | | } |
| | 65 | |
|
| | 66 | | [Test] |
| | 67 | | public void ShowAdultWarningProperly() |
| | 68 | | { |
| 1 | 69 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model() { adultContent = true }); |
| | 70 | |
|
| 1 | 71 | | Assert.IsTrue(view.adultContent.activeSelf); |
| 1 | 72 | | } |
| | 73 | |
|
| | 74 | | [Test] |
| | 75 | | public void HideAdultWarningProperly() |
| | 76 | | { |
| 1 | 77 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model() { adultContent = false }); |
| | 78 | |
|
| 1 | 79 | | Assert.IsFalse(view.adultContent.activeSelf); |
| 1 | 80 | | } |
| | 81 | |
|
| | 82 | | [Test] |
| | 83 | | public void ShowGamlingWarningProperly() |
| | 84 | | { |
| 1 | 85 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model() { gamblingContent = true }); |
| | 86 | |
|
| 1 | 87 | | Assert.IsTrue(view.gamblingContent.activeSelf); |
| 1 | 88 | | } |
| | 89 | |
|
| | 90 | | [Test] |
| | 91 | | public void HideGamlingWarningProperly() |
| | 92 | | { |
| 1 | 93 | | controller.ShowTermsOfService(new TermsOfServiceHUDController.Model() { gamblingContent = false }); |
| | 94 | |
|
| 1 | 95 | | Assert.IsFalse(view.gamblingContent.activeSelf); |
| 1 | 96 | | } |
| | 97 | | } |