public void ToStringTest() { //test wish for user tostring Wish wish = GetSimpleWish(); wish.WishUser = UserTests.GetSimpleUser(1); Assert.AreEqual("Ønsker at snakke med Bob Bobsen.", wish.ToString(), "ToString not correct for user wish"); //test organization wish.WishUser = null; wish.WishOrganization = new Organization("Org") { Id = 1 }; Assert.AreEqual("Ønsker at snakke med en person som har arbejdet i organisationen \"Org\".", wish.ToString(), "ToString not correct for organization."); wish.WishOrganizationTime = 1; Assert.AreEqual("Ønsker at snakke med en person som har arbejdet i organisationen \"Org\" i 1 år.", wish.ToString(), "ToString not correct for organization (years)."); wish.WishOrganization = null; Assert.AreEqual("Ønsker at snakke med en person som har arbejdet i en organisation i 1 år.", wish.ToString(), "ToString not correct for organization time."); //Test interests wish = GetSimpleWish(); wish.WishInterests = new List <WishInterests>() { new WishInterests(InterestTests.GetSimpleInterest(), wish) }; Assert.AreEqual("Ønsker at snakke med en person som har 1 interesse.", wish.ToString(), "ToString not correct for single interest"); wish.WishInterests.Add(new WishInterests(InterestTests.GetSimpleInterest(), wish)); Assert.AreEqual("Ønsker at snakke med en person som har 2 interesser.", wish.ToString(), "ToString not correct for multiple interests"); //Test businesses wish = GetSimpleWish(); wish.WishBusinesses = new List <WishBusinesses>() { new WishBusinesses(BusinessTests.GetSimpleBusiness(), wish) }; Assert.AreEqual("Ønsker at snakke med en person som arbejder i 1 erhverv.", wish.ToString(), "ToString not correct for single business"); //Test wish with 2 parts wish.WishInterests = new List <WishInterests>() { new WishInterests(InterestTests.GetSimpleInterest(), wish) }; Assert.AreEqual("Ønsker at snakke med en person som har 1 interesse og arbejder i 1 erhverv.", wish.ToString(), "ToString not correct with 2 wish parts"); //Test wish with 3 parts wish.WishOrganization = new Organization("Org") { Id = 1 }; Assert.AreEqual("Ønsker at snakke med en person som har 1 interesse, arbejder i 1 erhverv og har arbejdet i organisationen \"Org\".", wish.ToString(), "ToString not correct with 3 wish parts"); }
// Use this for initialization void Start() { System.Array values = System.Enum.GetValues(typeof(Wish)); m_thisWish = (Wish)values.GetValue(Random.Range(0, values.Length)); m_text.text = m_thisWish.ToString() + "?"; }