// Start is called before the first frame update void Start() { flowchart = GameObject.Find("Flowchart").GetComponent <Flowchart>(); //creates the SayingMatcher this.sm = new SayingMatcher(keys, solutions); //sets dictionary with player combinations this.playerCombinations = new Dictionary <string, string>(); //initiate keys with empty values for (int i = 0; i < keys.Length; i++) { this.playerCombinations[keys[i]] = null; } //sets line to be drawn between objects lines = new Dictionary <string, Line>(); for (int i = 0; i < keys.Length; i++) { //initiates lines, currently with no start or end points Line l = new Line(null, null, CreateLineObject()); lines.Add(keys[i], l); } instance = this; PlayWelcomeMessage(); }
public void InitiateSayingMatcher() { string[] a = { "a", "b", "c" }; string[] b = { "1", "2", "3" }; sm = new SayingMatcher(a, b); Assert.Pass("Saying matcher succesfully made "); }
public void CheckCorrectAnswer() { string[] keys = { "ab", "cd", "ef", "gh" }; string[] vals = { "12", "34", "56", "78" }; sm = new SayingMatcher(keys, vals); Dictionary <string, string> d = new Dictionary <string, string>(); for (int i = 0; i < keys.Length; i++) { d.Add(keys[i], vals[i]); } //checks if one correcyly is told 1 of 4 is correct int[] correctFraction1 = { 1, 4 }; d["cd"] = "12"; d["ef"] = "12"; d["gh"] = "12"; Assert.AreEqual(correctFraction1, sm.CheckCorrectAnswers(d)); //checks if one correcyly is told 2 of 4 is correct int[] correctFraction2 = { 2, 4 }; d["cd"] = "34"; Assert.AreEqual(correctFraction2, sm.CheckCorrectAnswers(d)); //checks if one correcyly is told 3 of 4 is correct int[] correctFraction3 = { 3, 4 }; d["ef"] = "56"; Assert.AreEqual(correctFraction3, sm.CheckCorrectAnswers(d)); //checks if one correcyly is told 4 of 4 is correct int[] correctFraction4 = { 4, 4 }; d["gh"] = "78"; Assert.AreEqual(correctFraction4, sm.CheckCorrectAnswers(d)); }
public void TestMatchingLength() { string[] a = { "a", "b" }; string[] b = { "1", "2", "3" }; try { sm = new SayingMatcher(a, b); Assert.Fail("Did not get expected exception "); } catch (System.ArgumentException e) { Assert.AreEqual(e.Message, "The sayings lists must be of equal length "); } string[] a1 = { "a", "b", "c" }; string[] b1 = { "1", "2" }; try { sm = new SayingMatcher(a1, b1); Assert.Fail("Did not get expected exception "); } catch (System.ArgumentException e) { Assert.AreEqual(e.Message, "The sayings lists must be of equal length "); } }