| | 1 | | using NUnit.Framework; |
| | 2 | | using System.Collections; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | public class PlayerInfoCardHUDControllerShould : IntegrationTestSuite_Legacy |
| | 6 | | { |
| | 7 | | private PlayerInfoCardHUDController controller; |
| | 8 | |
|
| | 9 | | protected override IEnumerator SetUp() |
| | 10 | | { |
| 3 | 11 | | yield return base.SetUp(); |
| 3 | 12 | | controller = new PlayerInfoCardHUDController(); |
| 3 | 13 | | UserProfileController.i.AddUserProfileToCatalog(new UserProfileModel() |
| | 14 | | { |
| | 15 | | userId = "userId", |
| | 16 | | name = "username", |
| | 17 | | description = "description", |
| | 18 | | email = "email", |
| | 19 | | inventory = new string[] { } |
| | 20 | | }); |
| 3 | 21 | | } |
| | 22 | |
|
| | 23 | | protected override IEnumerator TearDown() |
| | 24 | | { |
| 3 | 25 | | controller.Dispose(); |
| 3 | 26 | | yield return base.TearDown(); |
| 3 | 27 | | } |
| | 28 | |
|
| | 29 | | [Test] |
| | 30 | | public void CreateTheView() |
| | 31 | | { |
| 1 | 32 | | Assert.IsNotNull(controller.view); |
| 1 | 33 | | Assert.IsNotNull(controller.view.gameObject); |
| 1 | 34 | | } |
| | 35 | |
|
| | 36 | | [Test] |
| | 37 | | public void CurrentPlayerNameIsFound() |
| | 38 | | { |
| 1 | 39 | | var currentPlayerName = Resources.Load<StringVariable>(PlayerInfoCardHUDController.CURRENT_PLAYER_ID); |
| 1 | 40 | | Assert.IsNotNull(controller.currentPlayerId); |
| 1 | 41 | | Assert.AreEqual(currentPlayerName, controller.currentPlayerId); |
| 1 | 42 | | } |
| | 43 | |
|
| | 44 | | [Test] |
| | 45 | | public void ReactToCurrentPlayerNameChanges() |
| | 46 | | { |
| | 47 | | UserProfile userProfile; |
| 1 | 48 | | using (var iterator = UserProfileController.userProfilesCatalog.GetEnumerator()) |
| | 49 | | { |
| 1 | 50 | | iterator.MoveNext(); |
| 1 | 51 | | userProfile = iterator.Current.Value; |
| 1 | 52 | | } |
| | 53 | |
|
| 1 | 54 | | controller.currentPlayerId.Set(userProfile.userId); |
| 1 | 55 | | Assert.AreEqual(controller.currentUserProfile, userProfile); |
| 1 | 56 | | } |
| | 57 | | } |