public void BePopulatedCorrectly() { var model1 = new FriendEntry.Model() { userName = "******", avatarImage = Texture2D.whiteTexture }; var model2 = new FriendEntry.Model() { userName = "******", avatarImage = Texture2D.blackTexture }; entry.userId = "userId1"; entry.Populate(model1); entry.SetReceived(true); Assert.AreEqual(model1.userName, entry.playerNameText.text); Assert.AreEqual(model1.avatarImage, entry.playerImage.texture); Assert.IsFalse(entry.cancelButton.gameObject.activeSelf); Assert.IsTrue(entry.acceptButton.gameObject.activeSelf); Assert.IsTrue(entry.rejectButton.gameObject.activeSelf); entry.userId = "userId2"; entry.Populate(model2); entry.SetReceived(false); Assert.AreEqual(model2.userName, entry.playerNameText.text); Assert.AreEqual(model2.avatarImage, entry.playerImage.texture); Assert.IsTrue(entry.cancelButton.gameObject.activeSelf); Assert.IsFalse(entry.acceptButton.gameObject.activeSelf); Assert.IsFalse(entry.rejectButton.gameObject.activeSelf); }
public void BePopulatedCorrectly() { Sprite testSprite1 = Sprite.Create(Texture2D.whiteTexture, Rect.zero, Vector2.zero); Sprite testSprite2 = Sprite.Create(Texture2D.blackTexture, Rect.zero, Vector2.zero); var model1 = new FriendEntry.Model() { userName = "******", avatarImage = testSprite1 }; var model2 = new FriendEntry.Model() { userName = "******", avatarImage = testSprite2 }; entry.userId = "userId1"; entry.Populate(model1); entry.SetReceived(true); Assert.AreEqual(model1.userName, entry.playerNameText.text); Assert.AreEqual(model1.avatarImage, entry.playerImage.sprite); Assert.IsFalse(entry.cancelButton.gameObject.activeSelf); Assert.IsTrue(entry.acceptButton.gameObject.activeSelf); Assert.IsTrue(entry.rejectButton.gameObject.activeSelf); entry.userId = "userId2"; entry.Populate(model2); entry.SetReceived(false); Assert.AreEqual(model2.userName, entry.playerNameText.text); Assert.AreEqual(model2.avatarImage, entry.playerImage.sprite); Assert.IsTrue(entry.cancelButton.gameObject.activeSelf); Assert.IsFalse(entry.acceptButton.gameObject.activeSelf); Assert.IsFalse(entry.rejectButton.gameObject.activeSelf); Object.Destroy(testSprite1); Object.Destroy(testSprite2); }